Go Introduction Learning

Source: Internet
Author: User
This is a creation in Article, where the information may have evolved or changed.

/golang/src/myproject/controllers/default.go ": modify| ATTRIB

2016/04/26 18:52:27 [INFO] Start building ...

# myproject/controllers

Controllers/default.go:14:newline in string

Controllers/default.go:15:syntax error:unexpected C at end of statement

2016/04/26 18:52:27 [erro] ==============Build failed ===================

2016/04/26 18:52:28 [SKIP] "Mycode/golang/src/myproject/controllers/default.go": modify| ATTRIB


If you notice this, the equivalent of instant compilation, you can immediately see the error.


Vim.. /controllers/default.go

Vim.. /views/index.tpl


It seems that the structure of MVC is very clear and the efficiency is not very high? The development efficiency may come up a lot? At least it feels pretty straightforward, the basic concept of the standard PHP or Web mvc.

INDEX.TPL {{}} includes properties. Controls data[']=xxxx


Package controllers


Import (

"Github.com/astaxie/beego"

)


Type Maincontroller struct {

Beego. Controller

}


Func (c *maincontroller) Get () {

c.data["Website"] = "eego.me"

c.data["Email"] = "ie@gmail.com"

c.data["Dictionary"]= "My Dictionary is here"

C.tplname = "Index.tpl"

}


template File,nothing Special. It s common template HTML files,just like any defined templates

<! DOCTYPE html>



{{. Dictionary}}

</div>

<footer>

<div class= "Author" >

Official website:

<a href= "http://{{. Website}} ">{{. Website}}</a>/



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.