Skip to content

test: split TestGetVersion; remove toolchain #1303

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 10, 2025

Conversation

alexandear
Copy link
Collaborator

@alexandear alexandear commented Apr 9, 2025

The PR splits TestGetVersion into two: TestGetDevelopmentVersion and TestGetReleaseVersion.

TestGetDevelopmentVersion slightly differs for Go 1.24 and Go 1.23. So, I split it into:

  • main_pre_go1.24_test.go: //go:build !go1.24 means Go 1.23 and below.
  • main_go1.24_test.go: //go:build go1.24 means Go 1.24 and above.

Also, the PR removes unnecessary requirement of using the latest Go during development (toolchain in go.mod) and drops 1.22 in CI (because we support only Go 1.23+).

Inspired by #1302.

@alexandear alexandear changed the title test: split TestGoVersion; remove toolchain test: split TestGetVersion; remove toolchain Apr 9, 2025
@alexandear alexandear force-pushed the refactor/split-test-version branch from 2fd9a7d to 07674d8 Compare April 9, 2025 10:52
@alexandear alexandear force-pushed the refactor/split-test-version branch from 07674d8 to 1469e47 Compare April 9, 2025 10:58
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎨

I wouldn't prefix them with main_

It leads to some confusions with possible build tag available via file suffix. Like main_386_test.go

I initially thought main_test.go file wasn't used.

Maybe you could rename these files with a common prefix that is not main_

Copy link
Collaborator Author

@alexandear alexandear Apr 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Renamed main_go123_test.go to main_pre_go124_test.go (similar to pre_go120.go https://github.com/golang/sync/tree/10739b037d369c748d671b216356d7e04ce68da1/errgroup)

The prefix main_ is expected by Go convention https://pkg.go.dev/cmd/go#hdr-Test_packages:

  • main_test.go contains tests for main.go

  • main_pre_go124_test.go contains tests for main.go, but only for Go 1.23 and below

  • main_go124_test.go contains tests for main.go, but only for Go 1.24 and above

@chavacava chavacava merged commit 7b2c7e7 into mgechev:master Apr 10, 2025
7 checks passed
@alexandear alexandear deleted the refactor/split-test-version branch April 10, 2025 07:37
mfederowicz pushed a commit to mfederowicz/revive that referenced this pull request Apr 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants