$ go get https://github.com/golang/example
go: cannot determine module path for source directory /Users/sshridhar (outside GOPATH, no import comments)
$ go get http://github.com/golang/example
go: cannot determine module path for source directory /Users/sshridhar (outside GOPATH, no import comments)
$ go get http://github.com/golang/example.git
go: cannot determine module path for source directory /Users/sshridhar (outside GOPATH, no import comments)
It always tried to go to /Users/sshridhar where as go folders are here : /Users/sshridhar/go
I have had similar setup working earlier. Not sure, what has changed meanwhile. Any help on resolving this.
I think this is the problem. Does this file exist? Your go thinks it is inside a program with modules so then you run go get it tries to update this file but it is maybe empty or contains not the module path.
Yep. There is no file at : /Users/sshridhar/go.mod
So, I did export GOMOD = “”, added to my .bashrc (sourced), but go env doesnt seem to pick that. Where/how should i change that ? and should i keep it “” ?