diff --git a/internal/modproxy/modproxy.go b/internal/modproxy/modproxy.go index a60fdfc..023e58f 100644 --- a/internal/modproxy/modproxy.go +++ b/internal/modproxy/modproxy.go @@ -26,6 +26,12 @@ import ( // GOPROXY is the default module proxy var GOPROXY = "https://proxy.golang.org" +func init() { + if s := os.Getenv("GOPROXY"); s != "" { + GOPROXY = s + } +} + // Module contains the module path and versions type Module struct { Path string diff --git a/main.go b/main.go index 6b97c6b..f6ed65f 100644 --- a/main.go +++ b/main.go @@ -34,12 +34,6 @@ The commands are: help show this help text ` -func init() { - if goproxy := os.Getenv("GOPROXY"); goproxy != "" { - modproxy.GOPROXY = goproxy - } -} - func main() { flag.Usage = func() { fmt.Println(help)