问题:
go run 文件名.go。过后报出flag provided but not defined: -goversion。
环境:
go 1.9.2
在网上没有找到解决方法。特来求助,提前谢谢大佬。
我先去stackoverflow去查过了,没有找到答案。都是一些类似的,但都是来自于docker或者其他项目的。
go env打印的东西:
```
GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"
GOPATH="/Users/baihaihui/go"
GORACE=""
GOROOT="/usr/local/go"
GOTOOLDIR="/usr/local/go/pkg/tool/darwin_amd64"
GCCGO="gccgo"
CC="clang"
GOGCCFLAGS="-fPIC -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/cl/ql8hj8vn1fs68c2yh1b3y9yr0000gn/T/go-build314152862=/tmp/go-build -gno-record-gcc-switches -fno-common"
CXX="clang++"
CGO_ENABLED="1"
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
```
代码:(hello.go)
```go
package main
import (
"fmt"
)
func main() {
fmt.Println("Hello, playground")
}
```
执行命令:
go run hello.go
结果:
```
# command-line-arguments
flag provided but not defined: -goversion
usage: compile [options] file.go...
-% debug non-static initializers
-+ compiling runtime
-B disable bounds checking
-D path
set relative path for local imports
-E debug symbol export
-I directory
add directory to import search path
-K debug missing line numbers
-N disable optimizations
-S print assembly listing
-V print compiler version
-W debug parse tree after type checking
-asmhdr file
write assembly header to file
-bench file
append benchmark times to file
-buildid id
record id as the build id in the export metadata
-complete
compiling complete package (no C or assembly)
-cpuprofile file
write cpu profile to file
....(后面的省略了)
```
#5