初级会员
  • 第 9779 位会员
  • Ai01
  • 2017-07-11 01:52:21
  • Offline
  • 20 8

最近发布的文章

    暂无

最近分享的资源

    暂无

最近发布的项目

    暂无

最近的评论

  • # 解决方法 > 我找到答案了。正在尝试解决。先贴出地址:https://stackoverflow.com/questions/46241177/in-gogland-i-get-flag-provided-but-not-defined-goversion-using-go-run
  • #4 @wi-cuckoo ### 我先去stackoverflow去查过了,没有找到答案。都是一些类似的,但都是来自于docker或者其他项目的。 # go env打印的东西 ```go 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-build483639360=/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" ``` # 代码 ```go package main import ( "fmt" ) func main() { fmt.Println("Hello, playground") } ``` # 操作 ```go go run hello.go ``` # 结果: ![image.png](https://static.studygolang.com/171102/6c1151cd298b6d36fc176af0c748a507.png)
  • #4 @wi-cuckoo 我先去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 ....(后面的省略了) ```
  • #2 @wi-cuckoo 就是helloworld都跑不过了