Go报错: package command-line-arguments is not a main package

  • Error message:

insert image description here

  • Alas, nai nai de bullying go Xiaobai is not !

insert image description here

  • solve

insert image description here

Long-winded sentence: warning: GOPATH set to GOROOT (your goroot name) has no effect

gopath 设置一下,并且不要和 goroot 设置成同一个目录

  • GOPATH should not point to the Go installation path, but to your workspace (see https://golang.org/doc/code.h… ). Whenever you use go getor go installinstall a package, it is thrown into GOPATH. That's why it warns you. You definitely don't want every package you install online to be dumped into your Go installation.

You can also create one or more folders you want to use to develop Go code, and set them as GOPATH (but note that if you set multiple folders, then go get will only install the package to the first file folder).

Guess you like

Origin blog.csdn.net/RandyHan/article/details/128685505