mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-26 23:39:13 +00:00
826541b266
Previously, we were caching private Go modules' information, even when `cachePrivatePackages=false`. This leads to the module path, versions, and possibly the `go` directive being cached unintentionally. Instead of doing so, we should make sure that we're intentionally caching packages. To do this, we can use a mix of the `GOPRIVATE`/`GONOPROXY` to determine which packages shouldn't be fetched in the public Go proxy, given they're private, following how the Go toolchain itself does this. When interacting with the public Go proxy, we treat these packages as public (as the public Go proxy has no means to authenticate) and so anything outside of this should be treated as private. When `GOPROXY` contains `direct`, we only treat a package as public only when the public proxy is in the list too, the way Go's own default is written. This is used to imply that `direct` is the fallback for whatever the public proxy doesn't have. When thre is no Go proxy set, `GOPROXY=direct` means everything comes from source, which tells us nothing about who is allowed to read it. This doesn't catch everything: with the default `GOPROXY`, a private package the public proxy doesn't have falls through to `direct` and is still cached by Renovate, unless `GOPRIVATE` says otherwise. We only learn that no proxy served it after we've fetched it, which is after `cacheable` is determined. When using Renovate with a private Go proxy mirror, such as Artifactory, this will result in no cached packages until `cachePrivatePackages: true` is set. This is a similar change to #45348. Co-authored-by: Claude Opus 5 <jamie.tanna+claude-code@mend.io>