/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
如果注意到 这个情况,相当于即时编译,能够立刻看到错误。
vim ../controllers/default.go
vim ../views/index.tpl
目前看起来MVC的结构非常清晰,效率是不是很高?开发效率也许会上来很多?至少感觉挺直接的,标准的php or web mvc的基本概念。
index.tpl {{}}其中包括属性。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"
}
<!DOCTYPE html>
<html>
<head>
{{.Dictionary}}
</div>
</header>
<footer>
<div class="author">
Official website:
<a href="http://{{.Website}}">{{.Website}}</a> /
有疑问加站长微信联系(非本文作者)