Open
Description
Let's say I have a module, foo
, with a main.go
file with a dependency on filippo.io/edwards25519
. If I run or build main.go
from inside foo
, everything goes well.
If I run it or build it from outside the module, I get
$ go run foo/main.go
foo/main.go:3:8: no required module provides package filippo.io/edwards25519: working directory is not part of a module
If I run it or build it from inside a different module, I get
$ go run ../foo/main.go
../foo/main.go:3:8: no required module provides package filippo.io/edwards25519; to add it:
go get filippo.io/edwards25519
In both cases, the error message could have noticed that main.go
is inside a (different) module, and added something like
note: the file is in a module that is not active, to activate it:
cd .../foo
(go run
and go build
with .go
files are a constant source of confusion, got way less useful with modules because one can't just run arbitrary files as scripts from anywhere, and should IMHO be deprecated, but while we support them we should try to make them less painful.)