]> Cypherpunks repositories - gostls13.git/commit
cmd/go: inject vendor dir into builder struct
authorIan Alexander <jitsu@google.com>
Fri, 10 Oct 2025 01:01:05 +0000 (21:01 -0400)
committerIan Alexander <jitsu@google.com>
Fri, 24 Oct 2025 14:21:16 +0000 (07:21 -0700)
commit6a5a45252848b1bac795fc5c3e29680350462f81
tree8d708472a28b68be870ebf8461bf124778b2f1ab
parentdfac972233873c13e449689ce16aa1b9707dd20e
cmd/go: inject vendor dir into builder struct

This change adds a new field to the Builder struct to store a function
to retrieve the current vendor directory.  This allows us to delay the
determination of the vendor directory until later, which is currently
necessary to successful interaction with the module loader state.
This behavior will be changed in a future CL and the Builder field
will then be removed.

In addition, a new method to get the vendor dir from the module loader
state is added that will return the empty string instead of panicing.

This commit is part of the overall effort to eliminate global
modloader state.

Change-Id: Ib0165edb9502d98ddfa986acf5579c1b746a026f
Reviewed-on: https://go-review.googlesource.com/c/go/+/711133
Reviewed-by: David Chase <drchase@google.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
12 files changed:
src/cmd/go/internal/bug/bug.go
src/cmd/go/internal/envcmd/env.go
src/cmd/go/internal/list/list.go
src/cmd/go/internal/modload/init.go
src/cmd/go/internal/run/run.go
src/cmd/go/internal/test/test.go
src/cmd/go/internal/tool/tool.go
src/cmd/go/internal/vet/vet.go
src/cmd/go/internal/work/action.go
src/cmd/go/internal/work/build.go
src/cmd/go/internal/work/exec.go
src/cmd/go/scriptcmds_test.go