From 8b374507fddb1bb514cae33da6b734548108cee7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Graber?= Date: Sun, 30 Mar 2025 23:00:04 -0400 Subject: [PATCH] shared/proxy: Make golangci-lint clean MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Graber --- shared/proxy/proxy.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/shared/proxy/proxy.go b/shared/proxy/proxy.go index 39c187c13c..dd346e0269 100644 --- a/shared/proxy/proxy.go +++ b/shared/proxy/proxy.go @@ -30,6 +30,7 @@ type envOnce struct { val string } +// Get gets the environment variable. func (e *envOnce) Get() string { e.once.Do(e.init) return e.val @@ -44,13 +45,14 @@ func (e *envOnce) init() { } } -// This is basically the same as golang's ProxyFromEnvironment, except it +// FromEnvironment is basically the same as golang's ProxyFromEnvironment, except it // doesn't fall back to http_proxy when https_proxy isn't around, which is // incorrect behavior. It still respects HTTP_PROXY, HTTPS_PROXY, and NO_PROXY. func FromEnvironment(req *http.Request) (*url.URL, error) { return FromConfig("", "", "")(req) } +// FromConfig returns a proxy function for the provided proxy servers. func FromConfig(httpsProxy string, httpProxy string, noProxy string) func(req *http.Request) (*url.URL, error) { return func(req *http.Request) (*url.URL, error) { var proxy, port string