尝试运行go get -u得到错误:软件包XXX:无法识别的导入路径“ _ / XXX”(导入路径不是以主机名开头)

I'm working in Windows.

Full Error: package /C/Go_Projects: unrecognized import path "/C/Go_Projects" (import path does not begin with hostname)

GOPATH=C:\Go_Projects GOROOT=C:\Go path=path;C:\Go_Projects\bin

Go_Projects contains: bin, src, pkg and some .bat files but that's it.

I've tried changing GOROOT/GOPATH to:

GOPATH=\\Go_Projects GOROOT=C:\Go\bin, \\Go\bin, \\Go

I'm not sure how to fix this, I keep getting errors and my GOPATH is never set properly.

I reproduced the error by trying go get -u without specifying the path. Go get -u fetches a remote repository and builds it, so you should pass a path, like this:

go get -u github.com/gorilla/mux

If you don't specify a path, it will consider the path to be the current working dir, which is probably not what you want to do.

And GOPATH is not a valid path for a go get, you could do it from a child directory though, but usually you pass the whole path as I mentioned above.