Skip to content

cmd/fix: go fix and go fix -diff report the "reverse" results #78167

Open

Description

@thaJeztah

Go version

go version go1.26.1 darwin/arm64

Output of go env in your module/workspace:

not relevant

What did you do?

This is really a "nit" 🙈 and maybe it was by design but I noticed it when updating some of my examples; it looks like go fix and go fix -diff are inconsistent and report the exact reverse of changed made.

Feel free to close this one if this was by design! ❤️ - if it was not by design, I'm happy to look at contributing a change 👍

Without -diff, go fix reports the number of fixes applied:

fix: applied 2 of 3 fixes; 1 file updated. (Re-run the command to apply more.)

With -diff, go fix reports the number of fixes skipped;

fix: 1 of 3 fixes skipped (e.g. due to conflicts)

What did you see happen?

With -diff:

go fix -mod=readonly -diff ./... > /dev/null
# example.com/f
# [example.com/f]
fix: 1 of 3 fixes skipped (e.g. due to conflicts)
# example.com/g
# [example.com/g]
fix: 1 of 3 fixes skipped (e.g. due to conflicts)
# example.com/h
# [example.com/h]
fix: 1 of 2 fixes skipped (e.g. due to conflicts)
# example.com/i
# [example.com/i]
fix: 2 of 3 fixes skipped (e.g. due to conflicts)
# example.com/j
# [example.com/j]
fix: 2 of 3 fixes skipped (e.g. due to conflicts)
# example.com/k_test
# [example.com/k_test]
fix: 1 of 2 fixes skipped (e.g. due to conflicts)

Running the same without -diff reports the exact reverse;

go fix -mod=readonly ./...
# example.com/f
# [example.com/f]
fix: applied 2 of 3 fixes; 1 file updated. (Re-run the command to apply more.)
# example.com/g
# [example.com/g]
fix: applied 2 of 3 fixes; 2 files updated. (Re-run the command to apply more.)
# example.com/h
# [example.com/h]
fix: applied 1 of 2 fixes; 1 file updated. (Re-run the command to apply more.)
# example.com/i
# [example.com/i]
fix: applied 1 of 3 fixes; 1 file updated. (Re-run the command to apply more.)
# example.com/j
# [example.com/j]
fix: applied 1 of 3 fixes; 1 file updated. (Re-run the command to apply more.)
# example.com/k_test
# [example.com/k_test]
fix: applied 1 of 2 fixes; 1 file updated. (Re-run the command to apply more.)

What did you expect to see?

Both to report the same 😅 - perhaps a combination of the two ("applied X fixes" is a more positive message and "re-run the command" makes it (potentially) actionable); something like...

fix: 1 file updated: applied 2 of 3 fixes, skipped 1 (e.g., due to conflicts); re-run the command to apply more.

Activity

  1. added
    ToolProposalIssues describing a requested change to a Go tool or command-line program.
    on Mar 15, 2026
  2. thediveo commented on Mar 15, 2026

    @thediveo
    Contributor

    I would really want to see the reasons why fixes were skipped if any, instead of a number and a comment straight off an LLM.

  3. thaJeztah commented on Mar 15, 2026

    @thaJeztah
    ContributorAuthor

    @thediveo you mean why my example failed? Or did you mean "I would like the messages printed by go fix to include the reason"? 😅

    If it's because you were curious what example produced it; this was related to #78164 and #78165 (78164 has an example module uploaded as attachment if you want to try it) 😅

  4. thediveo commented on Mar 15, 2026

    @thediveo
    Contributor

    Actually both, but I don't want to sideload the issue.

  5. added this to the Go1.27 milestone on Mar 16, 2026
  6. added
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on Mar 16, 2026
  7. modified the milestones: Go1.27, Go1.28 on Aug 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.ToolProposalIssues describing a requested change to a Go tool or command-line program.

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions