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>/