cmd/go: report an added go directive as added, not downgraded#80034
cmd/go: report an added go directive as added, not downgraded#80034harjothkhara wants to merge 1 commit into
Conversation
|
Thanks Jesus Loves you #SayerTurner |
|
This PR (HEAD: f038d5b) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/791300. Important tips:
|
f038d5b to
bf61540
Compare
|
This PR (HEAD: bf61540) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/791300. Important tips:
|
bf61540 to
fff69f6
Compare
|
This PR (HEAD: fff69f6) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/791300. Important tips:
|
|
Message from Harjoth Khara: Patch Set 3: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/791300. |
|
Message from Dmitri Shuralyov: Patch Set 3: Code-Review+1 (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/791300. |
When 'go get go@version' runs in a module whose go.mod has no go directive, the go command synthesizes the current version into the in-memory requirements before writing the file. reportChanges then compared the requested version against that synthesized version and printed a misleading message, for example: go: downgraded go 1.27 => 1.20 even though the module never declared go 1.27. Report the change as the directive being added instead: go: added go 1.20 Determine whether the go.mod originally declared a go directive from the main module's index, which is not affected by the synthesized directive, and treat an absent directive as having no previous version. Existing go directives are still reported as upgrades or downgrades, and changes that only write back the synthesized version stay silent. This affects 'go get' in module mode with a single main module. In workspace mode the change report is still suppressed for an added go directive, but that is a separate, pre-existing issue (the workspace load synthesizes the directive into the in-memory go.mod before the change is computed) and is out of scope here. Fixes golang#63507
fff69f6 to
a451b8e
Compare
|
This PR (HEAD: a451b8e) has been imported to Gerrit for code review. Please visit Gerrit at https://go-review.googlesource.com/c/go/+/791300. Important tips:
|
|
Message from Harjoth Khara: Patch Set 4: (2 comments) Please don’t reply on this GitHub thread. Visit golang.org/cl/791300. |
|
Message from Harjoth Khara: Patch Set 4: (1 comment) Please don’t reply on this GitHub thread. Visit golang.org/cl/791300. |
When 'go get go@version' runs in a module whose go.mod has no go
directive, the go command synthesizes the current version into the
in-memory requirements before writing the file. reportChanges then
compared the requested version against that synthesized version and
printed a misleading message, for example:
even though the module never declared go 1.27. Report the change as the
directive being added instead:
Determine whether the go.mod originally declared a go directive from the
main module's index, which is not affected by the synthesized directive,
and treat an absent directive as having no previous version. Existing go
directives are still reported as upgrades or downgrades, and changes that
only write back the synthesized version stay silent.
This affects 'go get' in module mode with a single main module. In
workspace mode the change report is still suppressed for an added go
directive, but that is a separate, pre-existing issue (the workspace
load synthesizes the directive into the in-memory go.mod before the
change is computed) and is out of scope here.
Fixes #63507
Fixes #70090