mirror of
https://github.com/renovatebot/renovate.git
synced 2026-10-27 07:50:47 +00:00
868395fb5d
* refactor(workers/lookup): move the gomod pseudo-version check into the go datasource The only manager-name check in `lookupUpdates()` relabelled an update between two Go pseudo-versions as a `digest` update (#29034). Knowing that `v0.0.0-<timestamp>-<commit>` identifies a commit rather than a release belongs to the Go ecosystem, so `DatasourceApi` gains an optional `isPseudoVersion()`, `GoDatasource` implements it, and the lookup asks the datasource instead of the manager. The gomod manager's own `v0.0.0-` check calls the same helper. Behaviour change: the relabelling is keyed on the `go` datasource instead of the `gomod` manager, so it now also applies to the other managers using that datasource (bazel, mise, ocb), and no longer applies to a `gomod` dependency whose datasource was overridden to something else. The recognised pseudo-version form is unchanged: only the `v0.0.0-` prefix, not every form matched by `GoDatasource.pversionRegexp`. * refactor(workers/lookup): ask the go-mod-directive versioning about pseudo-versions Review feedback: version predicates are the domain of `lib/modules/versioning`, not of the datasource API. `isPseudoVersion()` now lives in the `go-mod-directive` versioning (the Go versioning module) and the optional `DatasourceApi.isPseudoVersion?()` hook is gone. The lookup worker and the gomod manager import the versioning helper directly. Because the lookup no longer asks the datasource, the predicate has to be exact: it matches the anchored `v0.0.0-<timestamp>-<commit>` shape (with the optional pre-release segment `GoDatasource.pversionRegexp` also allows) instead of the `v0.0.0-` prefix, so that no manager or datasource gating is needed. The forms derived from tags (`v1.2.3-0.…`) stay unrecognised, as before. * refactor(workers/lookup): keep the pseudo-version relabelling limited to gomod Review feedback: the move of the predicate into the versioning module should not widen which dependencies get relabelled. The `config.manager === 'gomod'` condition is back in front of the `isPseudoVersion()` checks, so the lookup behaves as on main. * refactor(workers/lookup): ask the gomod versioning about pseudo-versions Review feedback: the pseudo-version predicate has nothing to do with the `go` directive, so it moves from `go-mod-directive` to the new `gomod` versioning, which is the home for Go module version helpers (#44184). The lookup worker and `gomod/update.ts` use its `isUntaggedPseudoVersion()`, which is `isPseudoVersion()` limited to `v0.0.0-` pseudo-versions, so which dependencies are relabelled or written directly stays as on main. `go-mod-directive` is unchanged against main again. * fix(workers/lookup): treat pseudo-versions of major version modules like v0 ones Review feedback: Go writes a pseudo-version without a base release as `vX.0.0-<time>-<commit>`, with the major version of the module path, so a `/v2` module without releases gets `v2.0.0-…`. Only `v0.0.0-` was recognised, so an update between two such pseudo-versions was not relabelled as a digest update (#29034), and gomod/update.ts wrote the bare commit instead of the new pseudo-version. The lookup and the update now use `isPseudoVersion()` from the `gomod` versioning, and `isUntaggedPseudoVersion()` is gone. The go datasource only returns pseudo-versions for modules without releases, which always have that form, so nothing else changes. The lookup keeps its `config.manager === 'gomod'` condition. * refactor(workers/lookup): drop the guards around isPseudoVersion() Review feedback: `isPseudoVersion()` now accepts an undefined version, so the lookup and gomod/update.ts pass their optional values to it directly.