From af1fcfa072fb0a1d5196a6a949dc5fc4ed1438db Mon Sep 17 00:00:00 2001 From: Ilia Choly Date: Mon, 8 Jul 2024 12:27:40 -0400 Subject: [PATCH] fixup! Add support for GOPROXY env var --- internal/modproxy/modproxy.go | 6 ++++++ main.go | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-) 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)