Repository navigation
Bump Go to 1.27.2 and add modernize lint to CI - #218
Merged
Merged
Conversation
- Bump go directive from 1.26.0 to 1.27.2 (latest stable); CI picks it
up via go-version-file
- Bump golangci-lint from v2.7.1 to v2.15.0 in lint workflow
- Enable the modernize linter to catch outdated Go idioms, and fix all
reported findings:
- interface{} -> any (30 occurrences)
- mergeEnv: hand-written loop -> maps.Copy
- strings.Split -> strings.SplitSeq where only iterated
- Exclude goconst in _test.go files (stricter counting in newer
golangci-lint flags duplicated test literals only)
Verified locally: go build, go vet, gofmt, and golangci-lint v2.15.0
all pass with 0 issues.
Signed-off-by: yxxhero <aiopsclub@163.com>
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.
Summary
godirective from1.26.0to1.27.2(latest stable). CI test jobs follow automatically viago-version-file: go.mod. README prerequisites updated accordingly.v2.7.1tov2.15.0(latest).modernizelinter so outdated Go idioms fail CI instead of lingering, and fix everything it reported:interface{}→any(30 occurrences across 11 files)mergeEnv: hand-written map loop →maps.Copy(command.go)strings.Split→strings.SplitSeqwhere the slice is only iterated (replace.go)goconstfor_test.gofiles: newer golangci-lint counts more aggressively and only flagged duplicated test literals ("0.1.0","myapp", ...), which is not an idiom issue.No behavior changes: all fixes are type aliases and equivalent standard-library replacements.
Verification
go build ./...✅go vet ./...✅gofmt -l .clean ✅golangci-lint v2.15.0 run→ 0 issues ✅