From ff58ee962ac0a8c5a00931b86576276c8589ee51 Mon Sep 17 00:00:00 2001 From: Paul Jolly Date: Tue, 7 Apr 2020 06:26:42 +0100 Subject: [PATCH] main: only use local cache on install for -nonet Using the local module cache for installs unconditionally means that there will be situations where that cache is incomplete and hence the install (and any subsequent step) will fail. Rather we only need to enforce the use of the local module cache when we are in -nonet. Hence we now allow network access in the case of a module cache miss in the non-nonet situation, which is exactly the semantics we intend. Test to follow. Fixes #86 --- main.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/main.go b/main.go index cb7989e..02d5606 100644 --- a/main.go +++ b/main.go @@ -401,7 +401,11 @@ func mainerr() error { } installCmd.Args = append(installCmd.Args, mp.ImportPath) installCmd.Dir = pkg.wd - installCmd.Env = append(buildEnv(localCacheProxy), "GOBIN="+gobin) + proxy := "" + if *fNoNet { + proxy = localCacheProxy + } + installCmd.Env = append(buildEnv(proxy), "GOBIN="+gobin) if err := installCmd.run(); err != nil { return err }