Skip to content

cmd/fix: fails to make progress after printing "applied 3 of 4 fixes; 1 file updated. (Re-run the command to apply more.)" #78493

@oktalz

Description

@oktalz

Go version

go version go1.26.1 linux/amd64

Output of go env in your module/workspace:

AR='ar'
CC='gcc'
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_ENABLED='0'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
CXX='g++'
GCCGO='gccgo'
GO111MODULE=''
GOAMD64='v1'
GOARCH='amd64'
GOAUTH='netrc'
GOBIN=''
GOCACHE='/home/zlatko/.cache/go-build'
GOCACHEPROG=''
GODEBUG=''
GOENV='/home/zlatko/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFIPS140='off'
GOFLAGS=''
GOGCCFLAGS='-fPIC -m64 -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build1087837356=/tmp/go-build -gno-record-gcc-switches'
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMOD='/tmp/bug/go.mod'
GOMODCACHE='/home/zlatko/go/pkg/mod'
GONOPROXY=''
GONOSUMDB='REDACTED'
GOOS='linux'
GOPATH='/home/zlatko/go'
GOPRIVATE=''
GOPROXY='REDACTED'
GOROOT='/home/zlatko/.gobrew/current/go'
GOSUMDB='sum.golang.org'
GOTELEMETRY='on'
GOTELEMETRYDIR='/home/zlatko/.config/go/telemetry'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/home/zlatko/.gobrew/current/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.26.1'
GOWORK=''
PKG_CONFIG='pkg-config'

What did you do?

go.mod

module example.com/bug

go 1.26

main.go:
https://go.dev/play/p/BcNiWkxRNbA

go fix wants to apply four fixes simultaneously:

  1. stringsseq : strings.Split -> strings.SplitSeq (returns iter.Seq[string] instead of []string)
  2. stringscutprefix : strings.HasPrefix + strings.TrimPrefix -> strings.CutPrefix
  3. stringsseq : Inner strings.Split -> strings.SplitSeq
  4. slicescontains : for _, item := range slice { if item == target } -> slices.Contains(slice, target)

Fixes 3 and 4 conflict:

  • Fix 3 changes strings.Split(parts[1], ",") to strings.SplitSeq(...), which returns iter.Seq[string]
  • Fix 4 wants to replace the loop with slices.Contains(strings.Split(parts[1], ","), target), which requires ~[]E (a slice)

When both are pending, go fix applies 3 of the 4, skips the conflicting one, and tells you to re-run. But the next run faces the same conflict and applies 3 of 4 again, in a cycle.

What did you see happen?

$ go fix ./...
# example.com/bug
# [example.com/bug]
fix: applied 3 of 4 fixes; 1 file updated. (Re-run the command to apply more.)
$ go fix ./...
# example.com/bug
# [example.com/bug]
fix: applied 3 of 4 fixes; 1 file updated. (Re-run the command to apply more.)
$ go fix ./...
# example.com/bug
# [example.com/bug]
fix: applied 3 of 4 fixes; 1 file updated. (Re-run the command to apply more.)

no change in code

What did you expect to see?

I expected some improvements but nothing is changed

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugReportIssues describing a possible bug in the Go implementation.NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.RefactoringIssues related to refactoring tools

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions