Go version
go version go1.26.1 darwin/arm64
Output of go env in your module/workspace:
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.
Go version
go version go1.26.1 darwin/arm64
Output of
go envin your module/workspace: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 fixandgo fix -diffare 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 fixreports the number of fixes applied:fix: applied 2 of 3 fixes; 1 file updated. (Re-run the command to apply more.)With
-diff,go fixreports the number of fixes skipped;fix: 1 of 3 fixes skipped (e.g. due to conflicts)What did you see happen?
With
-diff:Running the same without
-diffreports the exact reverse;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.