Skip to content

tests: go fix instead of modernize#6

Merged
murfffi merged 1 commit intomainfrom
chore/go126
Apr 28, 2026
Merged

tests: go fix instead of modernize#6
murfffi merged 1 commit intomainfrom
chore/go126

Conversation

@murfffi
Copy link
Copy Markdown
Member

@murfffi murfffi commented Apr 28, 2026

also bumps testify and go patch version

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request updates the Go version to 1.26.2 and the testify dependency to v1.11.1. It also replaces the modernize tool with go fix in the Makefile. A critical issue was identified in the Makefile change: the go fix command does not support the -diff flag, and the current check logic is ineffective for detecting changes. It is recommended to use go fix followed by git diff --exit-code to properly verify that no migrations are pending.

Comment thread Makefile
go run golang.org/x/tools/gopls/internal/analysis/modernize/cmd/modernize@v0.20.0 ./...
# non-zero exit status on issues found
# nb: modernize is not part of golangci-lint yet - https://github.com/golangci/golangci-lint/issues/686
test -z $$(go fix -diff ./... | tee /dev/stderr)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

high

The go fix command does not support a -diff flag. Additionally, go fix modifies files in-place and is silent on success, so test -z will not detect changes. This check is also fragile: if go fix fails (e.g., due to the invalid flag), the error usually goes to stderr, making test -z pass incorrectly.

Note that go fix is not a direct replacement for the modernize tool. modernize checks for new language features (like any, min/max), while go fix is for legacy API migrations. If you want to verify no changes are needed, use the git diff pattern:

	go fix ./...
	git diff --exit-code

@murfffi murfffi merged commit 88288ac into main Apr 28, 2026
2 checks passed
@murfffi murfffi deleted the chore/go126 branch April 28, 2026 14:37
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.

1 participant