Skip to content

Commit 49736e0

Browse files
matloobSirherobrine23
authored andcommitted
cmd/doc: properly set GOPROXY to avoid deprecation checks
This change fixes a bug that was introduced in CL 675155. Instead of doing the two step download and run with GOPROXY=off, do the run with GOPROXY=<download cache>:$GOPROXY, so that we use the previously downloaded version of pkgsite as the latest. Fixes golang#73833 Change-Id: I8803426498ab026602805d6448a130eb11458c99 Reviewed-on: https://go-review.googlesource.com/c/go/+/675576 Reviewed-by: Jonathan Amsterdam <[email protected]> Reviewed-by: Michael Matloob <[email protected]> LUCI-TryBot-Result: Go LUCI <[email protected]>
1 parent 3275265 commit 49736e0

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/cmd/doc/main.go

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -258,11 +258,22 @@ func doPkgsite(urlPath string) error {
258258
// exit before exiting ourselves.
259259
signal.Ignore(signalsToIgnore...)
260260

261+
// Prepend the local download cache to GOPROXY to get around deprecation checks.
262+
env := os.Environ()
263+
vars, err := runCmd(nil, "go", "env", "GOPROXY", "GOMODCACHE")
264+
fields := strings.Fields(vars)
265+
if err == nil && len(fields) == 2 {
266+
goproxy, gomodcache := fields[0], fields[1]
267+
goproxy = "file://" + filepath.Join(gomodcache, "cache", "download") + "," + goproxy
268+
env = append(env, "GOPROXY="+goproxy)
269+
}
270+
261271
const version = "v0.0.0-20250520201116-40659211760d"
262272
cmd := exec.Command("go", "run", "golang.org/x/pkgsite/cmd/internal/doc@"+version,
263273
"-gorepo", buildCtx.GOROOT,
264274
"-http", addr,
265275
"-open", path)
276+
cmd.Env = env
266277
cmd.Stdout = os.Stderr
267278
cmd.Stderr = os.Stderr
268279

0 commit comments

Comments
 (0)