Conversation
`go fix` in Go 1.26 runs the modernizer analysers, so it rewrites `strings.HasPrefix`/`TrimPrefix` pairs into `strings.CutPrefix`, `sort.Slice` into `slices.Sort`, counted `for` loops into `for range n`, `strings.Fields` into `strings.FieldsSeq`, string accumulation into `strings.Builder`, and per-test contexts into `t.Context()`. It also drops `omitempty` from the two struct-typed fields of `bot.Message`, where the option has never had any effect: encoding/json treats only false, 0, nil pointers and empty arrays, slices, maps and strings as empty, so a struct is always encoded. The marshalled form of the message log written in `app/reporter/reporter.go` and read back in `app/reporter/export.go` is unchanged, and existing logs still parse. The alternative `omitzero` rewrite, which would change behaviour, is deliberately not applied. The `strings.Builder` rewrites left two `WriteString(fmt.Sprintf(...))` calls that staticcheck flags as QF1012; they are written as `fmt.Fprintf` instead.
Coverage Report for CI Build 32257769945Coverage decreased (-0.007%) to 75.104%Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
umputun
approved these changes
Aug 20, 2026
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.
Output of
go fix ./...on Go 1.26, where the command now runs the modernizer analysers. It rewritesstrings.HasPrefixandstrings.TrimPrefixpairs intostrings.CutPrefix,sort.Sliceintoslices.Sort, counted loops intofor range n,strings.Fieldsintostrings.FieldsSeq, string accumulation intostrings.Builder, and the per-testcontext.WithCancelpairs intot.Context().It also drops
omitemptyfrom the two struct-typed fields ofbot.Message. The option has never had an effect there: encoding/json treats only false, 0, nil pointers, nil interfaces and empty arrays, slices, maps and strings as empty, so a struct is always encoded. The marshalled form of the message log written inapp/reporter/reporter.goand read back inapp/reporter/export.gois byte for byte the same, and existing logs still parse. The alternative rewritego fixoffers here, replacingomitemptywithomitzero, would change behaviour and is deliberately not applied.The
strings.Builderrewrites left twoWriteString(fmt.Sprintf(...))calls that staticcheck reports as QF1012, so those are written asfmt.Fprintfinstead. Tests and golangci-lint are clean on the branch.