尝试安装BEEGO时出错

时间:2016-01-25 13:31:20

标签: go beego

我是GO的新手,当我尝试在我的Windows 8桌面或使用Debian8的VirtualBox上安装framwork beego时,我遇到了同样的错误:

sergi@odoo:~$ go get github.com/astaxie/beego
# github.com/astaxie/beego
work/src/github.com/astaxie/beego/tree.go:144: syntax error: unexpected range, expecting {
work/src/github.com/astaxie/beego/tree.go:155: syntax error: unexpected else, expecting semicolon or newline
work/src/github.com/astaxie/beego/tree.go:157: non-declaration statement outside function body
work/src/github.com/astaxie/beego/tree.go:158: non-declaration statement outside function body
work/src/github.com/astaxie/beego/tree.go:159: non-declaration statement outside function body
work/src/github.com/astaxie/beego/tree.go:160: syntax error: unexpected }
work/src/github.com/astaxie/beego/tree.go:257: syntax error: unexpected range, expecting {
work/src/github.com/astaxie/beego/tree.go:267: syntax error: unexpected else, expecting semicolon or newline or }
work/src/github.com/astaxie/beego/tree.go:283: syntax error: unexpected }

2 个答案:

答案 0 :(得分:3)

您似乎正在使用未能构建beego包的旧Go版本。

请注意,该软件包仅针对go 1.5.1进行测试。所以尝试升级到1.5.x并尝试再次获取它。

https://github.com/astaxie/beego/blob/master/.travis.yml#L4

我很确定升级会解决您的问题。

答案 1 :(得分:1)

Go 1.4中引入了空的for range循环。你的Go版本似乎更老了。使用

检查您的版本
go version

如果版本低于1.4,请安装较新版本from the official website