Skip to content

Bump Go to 1.27.2 and add modernize lint to CI - #218

Merged
yxxhero merged 1 commit into
masterfrom
ci/go1.27.2-modernize
Oct 20, 2026
Merged

yxxhero merged 1 commit into
masterfrom
ci/go1.27.2-modernize

Conversation

@yxxhero

@yxxhero yxxhero commented Oct 20, 2026

Copy link
Copy Markdown
Member

Summary

  • Go upgrade: bump go directive from 1.26.0 to 1.27.2 (latest stable). CI test jobs follow automatically via go-version-file: go.mod. README prerequisites updated accordingly.
  • golangci-lint upgrade: bump the lint workflow from v2.7.1 to v2.15.0 (latest).
  • New syntax/idiom check: enable the modernize linter 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.SplitSeq where the slice is only iterated (replace.go)
  • Exclude goconst for _test.go files: 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 ✅
  • Full test suite delegated to CI

- 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>
@yxxhero
yxxhero merged commit 38f5bcd into master Oct 20, 2026
4 checks passed
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