Closed
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Golang segment unit test expectations for versions parsed from go.mod, which validates the segment’s version-detection behavior when parse_mod_file is enabled.
Changes:
- Adjusts the expected version string for the
go.modparsing test case inTestGolang.
| {Case: "Go 1.15", ExpectedString: "1.15.8", Version: "go version go1.15.8 darwin/amd64"}, | ||
| {Case: "Go 1.16", ExpectedString: "1.16", Version: "go version go1.16 darwin/amd64"}, | ||
| {Case: "go.mod 1.26.0", ParseModFile: true, HasModFileInParentDir: true, ExpectedString: "1.26.0"}, | ||
| {Case: "go.mod 1.26.0", ParseModFile: true, HasModFileInParentDir: true, ExpectedString: "1.26.1"}, |
There was a problem hiding this comment.
This test case reads ../go.mod (which resolves to src/go.mod) and src/go.mod currently declares go 1.26.0. parseModFile() returns file.Go.Version verbatim, so the expected value here should match the go.mod directive (or the fixture should be updated). As written, this change makes the expectation inconsistent with the fixture and with the later case that expects 1.26.0 when both go.work and go.mod are present.
Suggested change
| {Case: "go.mod 1.26.0", ParseModFile: true, HasModFileInParentDir: true, ExpectedString: "1.26.1"}, | |
| {Case: "go.mod 1.26.0", ParseModFile: true, HasModFileInParentDir: true, ExpectedString: "1.26.0"}, |
de1d173 to
6a67260
Compare
76be359 to
eb5735d
Compare
eb5735d to
c0839f7
Compare
c0839f7 to
e6f576d
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prerequisites