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

8.5k views Asked by At

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

There are 1 answers

1
dlsniper On BEST ANSWER

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.