In Gogland I get 'flag provided but not defined: -goversion' using go run

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

In Gogland I get 'flag provided but not defined: -goversion' using go run

问题

我正在尝试在Gogland内置的终端中运行名为release.go的Go脚本,但是它给出了以下输出:

$ go run release.go
# command-line-arguments
flag provided but not defined: -goversion
usage: compile [options] file.go...
  -%    debug non-static initializers
...

如果我在Gogland之外的终端中运行这个release.go文件,它可以正常运行。

这个问题在我从版本1.8.3升级到1.9之后开始出现,而且我以前从未使用过-goversion标志。

当前的Gogland版本是:

Gogland (1.0 Preview) 1.0 EAP
Build #GO-172.3968.45, built on September 5, 2017
Gogland EAP User
Expiration date: December 4, 2017
JRE: 1.8.0_152-release-915-b11 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.6

我该如何解决这个问题,以便我可以在Gogland的内置终端中运行Go?

英文:

I am trying to run my go script called release.go in the Goglang built in terminal and it gives me the following output

$ go run release.go
# command-line-arguments
flag provided but not defined: -goversion
usage: compile [options] file.go...
  -%    debug non-static initializers
...

If I run this in my terminal outside of Gogland the release.go file runs without issue.

This problem started occurring after upgrading from version 1.8.3 to 1.9 and I have never used the -goversion flag before.

Current Gogland version:

Gogland (1.0 Preview) 1.0 EAP
Build #GO-172.3968.45, built on September 5, 2017
Gogland EAP User
Expiration date: December 4, 2017
JRE: 1.8.0_152-release-915-b11 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Mac OS X 10.12.6

How can I fix this problem so that I can run go from the built in terminal in Gogland?

答案1

得分: 8

你已经安装了一个来自一个发行版的Go版本,以及另一个来自另一个发行版的Go版本(可能一个来自Homebrew,另一个来自发行版的二进制文件,例如)。

请删除其中一个版本,因为你的系统目前处于未定义状态。

Gogland与此无关,因为在使用终端时它不会注入任何参数。你可以通过在func main()旁边点击绿色箭头来从Gogland本身运行文件,并且它将使用内部逻辑根据所选的SDK和提供的其他参数来确定执行模型。你可以通过运行|编辑配置来自定义构建过程。

英文:

You've installed one Go version from one distribution and another Go version from another distribution (likely one from Homebrew and another from the distribution binaries, for example).

Either remove one or the other as your system is currently in an undefined state.

Gogland has nothing to do with this as it does not inject any parameters when you are using the terminal. You can run the file from Gogland itself by clicking on the green arrow next to func main() and it will use the internal logic to determine the execution model based on the SDK selected and the other parameters provided. You can customize the build process via Run | Edit Configurations.

huangapple
  • 本文由 发表于 2017年9月15日 21:49:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/46241177.html
匿名

发表评论

匿名网友

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

确定