You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I init a go module outside my gopath and then run go build from that directory, it works as expected.
If I run go build /absolute/dir/of/module but my current working directory is inside my gopath, go build will try to look up dependencies in my gopath (and fail if they're not there).
This seems wrong. if I give a path to the code, the path of the code should be what determines whether or not to use modules, no the current directory of where go build is run. Otherwise, I get different behavior for building the same code in the same place dependent on the CWD, which is extremely confusing and hard to debug.
go version go1.11 darwin/amd64
GOROOT/bin/go version: go version go1.11 darwin/amd64
GOROOT/bin/go tool compile -V: compile version go1.11
uname -v: Darwin Kernel Version 17.7.0: Thu Jun 21 22:53:14 PDT 2018; root:xnu-4570.71.2~1/RELEASE_X86_64
ProductName: Mac OS X
lldb --version: lldb-902.0.79.7
The text was updated successfully, but these errors were encountered:
Addendum.... this came up as a problem because I would build go code outside my gopath, and the go tool downloaded the dependencies, but then I'd try to build the same code in the same location, but with the working directory inside gopath, and the go tool wouldn't be able to find the dependencies (because it was looking in gopath).
In the near future, you will always be in module mode by default. I can't justify the complexity of adding target-sensitive mode switching (and, in particular, of detecting mode-spanning arguments) when they would just be temporary anyway.