普通网友
2017-09-15 13:49
浏览 147
已采纳

在Gogland中,我使用go run获取了“提供的标志,但未定义:-goversion”

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?

图片转代码服务由CSDN问答提供 功能建议

我正在尝试在内置的Goglang中运行名为 release.go 的go脚本 终端,它会为我提供以下输出

  $去运行release.go 
#提供的命令行参数
flag,但未定义:-goversion 
usage:compile [ 选项] file.go ... 
-%调试非静态初始化程序
 ... 
   
 
 

如果我在Gogland以外的终端中运行 release.go 文件运行没有问题。

从1.8.3版本升级到1.9后开始出现此问题,而我从未使用过 -goversion

当前Gogland版本:

  Gogland(1.0预览版)1.0 EAP 
Build#GO-172.3968。  45,建于2017年9月5日
Gogland EAP用户
到期日期:2017年12月4日
JRE:1.8.0_152-release-915-b11 x86_64 
JVM:JetBrains的OpenJDK 64位服务器虚拟机
Mac OS X 10.12  .6 
   
 
 

如何解决此问题,以便我 可以从Gogland的内置终端运行go吗?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

1条回答 默认 最新

  • duanpo7282 2017-09-15 13:53
    最佳回答

    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.

    评论
    解决 无用
    打赏 举报

相关推荐 更多相似问题