diff options
author | Michael Matloob <matloob@golang.org> | 2020-08-11 12:57:01 -0400 |
---|---|---|
committer | Michael Matloob <matloob@golang.org> | 2020-10-06 19:00:07 +0000 |
commit | ab2a5b48665eed6d670d719cdef5335bc3602359 (patch) | |
tree | 8a897d0a57a5ff5b12e4cb52e3be610c9eb1e93e /src/cmd/go/internal/envcmd/env.go | |
parent | f8d80977b784fd4879963e61dc9fca1fc9bf2193 (diff) | |
download | go-ab2a5b48665eed6d670d719cdef5335bc3602359.tar.gz go-ab2a5b48665eed6d670d719cdef5335bc3602359.zip |
cmd/go: add basic support for overlays
This CL adds basic support for listing packages with overlays.
The new cmd/go/internal/fs package adds an abstraction for communicating
with the file system that will open files according to their overlaid paths,
and provides functions to override those in the build context to open
overlaid files. There is also some support for executing builds on packages
with overlays. In cmd/go/internal/work.(*Builder).build, paths are mapped
to their overlaid paths before they are given as arguments to tools.
For #39958
Change-Id: I5ec0eb9ebbca303e2f1e7dbe22ec32613bc1fd17
Reviewed-on: https://go-review.googlesource.com/c/go/+/253747
Trust: Michael Matloob <matloob@golang.org>
Trust: Jay Conrod <jayconrod@google.com>
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Go Bot <gobot@golang.org>
Reviewed-by: Jay Conrod <jayconrod@google.com>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
Diffstat (limited to 'src/cmd/go/internal/envcmd/env.go')
-rw-r--r-- | src/cmd/go/internal/envcmd/env.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/cmd/go/internal/envcmd/env.go b/src/cmd/go/internal/envcmd/env.go index ee0bb0d0b2..e1f2400f60 100644 --- a/src/cmd/go/internal/envcmd/env.go +++ b/src/cmd/go/internal/envcmd/env.go @@ -21,6 +21,7 @@ import ( "cmd/go/internal/base" "cmd/go/internal/cache" "cmd/go/internal/cfg" + "cmd/go/internal/fsys" "cmd/go/internal/load" "cmd/go/internal/modload" "cmd/go/internal/work" @@ -197,6 +198,10 @@ func runEnv(ctx context.Context, cmd *base.Command, args []string) { env := cfg.CmdEnv env = append(env, ExtraEnvVars()...) + if err := fsys.Init(base.Cwd); err != nil { + base.Fatalf("go: %v", err) + } + // Do we need to call ExtraEnvVarsCostly, which is a bit expensive? // Only if we're listing all environment variables ("go env") // or the variables being requested are in the extra list. |