Unfortunately, no, I don't see a way to scope entries in the GOPROXY
environment variable.
https://go.dev/ref/mod#environment-variables doesn't say anything about
such scoping in the GOPROXY entry.

I don't see any facility in the parsing code (at master)
<https://cs.opensource.google/go/go/+/master:src/cmd/go/internal/modfetch/proxy.go;l=50-127;drc=67903012f71b6ceff7a25758c33e77c47710fbf7>
 either.

You may want to open an issue. (note: there are a lot that match "GOPROXY",
so I"m not sure if there's an existing issue)

On Fri, Feb 27, 2026 at 7:16 AM Pierre Durand <[email protected]>
wrote:

> Unfortunately I can't use GOPRIVATE for my company private dependencies,
> because I must use the internal proxy, in order to manage the
> authentication.
>
> And I can't use GOPRIVATE for public dependencies, because:
> - it would require to list all possible public providers (github, gitlab,
> bitbucket, other domains, etc...)
> - it won't use the public proxy anymore, so it will be slower
>
> My main problem is:
> > Unfortunately, our proxy is slightly slower than the public Go proxy for
> public dependencies (github, etc...)
> That's why I want to use different proxies
>
> Le jeudi 26 février 2026 à 16:28:47 UTC+1, Jason E. Aten a écrit :
>
>> I think you might want GOPRIVATE
>>
>> https://www.goproxy.io/docs/GOPRIVATE-env.html
>>
>> On Thursday, February 26, 2026 at 7:22:36 AM UTC-3 Pierre Durand wrote:
>>
>>> At my company we use an internal Go proxy in order to access private
>>> dependencies.
>>> Our Go proxy manages the authentication to our dependencies repositories.
>>> So my config looks like this:
>>> GOPROXY='https://goproxy.mycompany.com,direct'
>>>
>>> Unfortunately, our proxy is slightly slower than the public Go proxy for
>>> public dependencies (github, etc...)
>>> So I would like to use the public Go proxy for public dependencies, and
>>> our internal Go proxy for private dependencies.
>>> I changed my config to:
>>> GOPROXY='https://proxy.golang.org,https://goproxy.mycompany.com,direct'
>>> It works well, but I think it could cause a small privacy issue: it
>>> always send a query to the public Go proxy for our private dependencies.
>>>
>>> Is it possible to use a specific Go proxy for a path/domain ?
>>> Something like
>>> GOPROXY='git.mycompany.com=https://goproxy.mycompany.com,
>>> https://proxy.golang.org,direct'
>>> (I know this syntax doesn't work)
>>> I think it would be very helpful to be able to configure a Go proxy for
>>> some domains/path.
>>>
>> --
> You received this message because you are subscribed to the Google Groups
> "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion visit
> https://groups.google.com/d/msgid/golang-nuts/8935144a-3fc3-47c8-a49c-fc8cc0f71745n%40googlegroups.com
> <https://groups.google.com/d/msgid/golang-nuts/8935144a-3fc3-47c8-a49c-fc8cc0f71745n%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/golang-nuts/CANrC0Bju%2Bjw9RwtfK-euCz0nfanM764AHCzz7Uu7SuM83PP%3DNA%40mail.gmail.com.

Reply via email to