The fetch.Resolver fallback path (resolveWithoutRegistry in fetch/resolver.go) builds download URLs from hardcoded public hosts (registry.npmjs.org, static.crates.io, rubygems.org, proxy.golang.org, repo.hex.pm, pub.dev, repo1.maven.org, api.nuget.org). NewResolver() has no way to override them, and callers that never RegisterRegistry always hit the fallback.
git-pkgs/proxy now lets every built-in upstream be configured (git-pkgs/proxy#255) so one proxy can chain to another or to a private mirror. The HTTP-serving path builds URLs itself and honours the config, but the mirror subcommand goes through fetch.Resolver and still fetches from the public registries regardless of what the operator set.
Proposed change: let NewResolver (or a new constructor / functional option) take a map[string]string of ecosystem → base URL and use it in place of the literals in resolveWithoutRegistry, falling back to the current defaults when a key is absent. registries.New(ecosystem, baseURL, client) already accepts a base URL, so an alternative is to have the resolver construct a Registry per ecosystem from that map instead of keeping the switch.
The
fetch.Resolverfallback path (resolveWithoutRegistryinfetch/resolver.go) builds download URLs from hardcoded public hosts (registry.npmjs.org,static.crates.io,rubygems.org,proxy.golang.org,repo.hex.pm,pub.dev,repo1.maven.org,api.nuget.org).NewResolver()has no way to override them, and callers that neverRegisterRegistryalways hit the fallback.git-pkgs/proxynow lets every built-in upstream be configured (git-pkgs/proxy#255) so one proxy can chain to another or to a private mirror. The HTTP-serving path builds URLs itself and honours the config, but themirrorsubcommand goes throughfetch.Resolverand still fetches from the public registries regardless of what the operator set.Proposed change: let
NewResolver(or a new constructor / functional option) take amap[string]stringof ecosystem → base URL and use it in place of the literals inresolveWithoutRegistry, falling back to the current defaults when a key is absent.registries.New(ecosystem, baseURL, client)already accepts a base URL, so an alternative is to have the resolver construct aRegistryper ecosystem from that map instead of keeping the switch.