尝试安装BEEGO时出现错误。

huangapple go评论83阅读模式
英文:

Error when try to install BEEGO

问题

我对GO非常陌生,当我尝试在我的Windows 8桌面或在VirtualBox中的Debian8上安装beego框架时,出现了相同的错误:

sergi@odoo:~$ go get github.com/astaxie/beego

github.com/astaxie/beego

work/src/github.com/astaxie/beego/tree.go:144: 语法错误:意外的range,期望{
work/src/github.com/astaxie/beego/tree.go:155: 语法错误:意外的else,期望分号或换行符
work/src/github.com/astaxie/beego/tree.go:157: 非声明语句在函数体外
work/src/github.com/astaxie/beego/tree.go:158: 非声明语句在函数体外
work/src/github.com/astaxie/beego/tree.go:159: 非声明语句在函数体外
work/src/github.com/astaxie/beego/tree.go:160: 语法错误:意外的}
work/src/github.com/astaxie/beego/tree.go:257: 语法错误:意外的range,期望{
work/src/github.com/astaxie/beego/tree.go:267: 语法错误:意外的else,期望分号或换行符或}
work/src/github.com/astaxie/beego/tree.go:283: 语法错误:意外的}

英文:

I am very new with GO, and when I tried to install the framwork beego on my Windows 8 Desktop or in a VirtualBox with Debian8 I had the same error:

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 }

答案1

得分: 3

你似乎正在使用一个旧的Go版本,无法构建beego包。

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

我相信升级将解决你的问题。

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

英文:

You seem to be using an old Go version which is failing to build the beego package.

Note that the package is only tested against go 1.5.1. So try upgrading to go 1.5.x and attempt to fetch it again.

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

I'm pretty sure the upgrade will fix your issues.

答案2

得分: 1

空的for range循环是在Go 1.4中引入的。你的Go版本似乎比较旧。使用以下命令检查你的版本:

go version

如果版本低于1.4,请从官方网站安装新版本。

英文:

The empty for range loops were introduced in Go 1.4. Your Go version seems to be older. Check your version with

go version

and if it's older than 1.4, install a newer version from the official website.

huangapple
  • 本文由 发表于 2016年1月25日 21:31:20
  • 转载请务必保留本文链接:https://go.coder-hub.com/34993894.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定