[tools] go/analysis/passes/modernize: document 'go fix' command

2 views
Skip to first unread message

Alan Donovan (Gerrit)

unread,
Jul 21, 2026, 9:58:01 PM (5 days ago) Jul 21
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com

Alan Donovan has uploaded the change for review

Commit message

go/analysis/passes/modernize: document 'go fix' command

Update the modernizer docs to recommend go fix in preference
to the the multichecker-based modernize command.

Also, delete the gopls/internal/analysis/modernize/cmd/modernize
command, which is internal and deprecated. This will break
'go run .../modernize@latest' at the next gopls release.

Fixes golang/go#80510
Change-Id: I5b27787b3afdaf86c5c1222b3cc02ab45c138a38

Change diff

diff --git a/go/analysis/passes/modernize/doc.go b/go/analysis/passes/modernize/doc.go
index bf83de3..f6c2d67 100644
--- a/go/analysis/passes/modernize/doc.go
+++ b/go/analysis/passes/modernize/doc.go
@@ -15,9 +15,15 @@
trivial to fix. We regard any modernizer whose fix changes program
behavior to have a serious bug and will endeavor to fix it.

-To apply all modernization fixes en masse, you can use the
+Since Go 1.26, the 'go fix' command has included the modernize suite,
+so to apply all modernization fixes en masse, you can use the
following command:

+ $ go fix ./...
+
+If you need to run a modernizer added or modified since the Go
+release, you can use this standalone command:
+
$ go run golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize@latest -fix ./...

(Do not use "go get -tool" to add gopls as a dependency of your
diff --git a/gopls/internal/analysis/modernize/cmd/modernize/main.go b/gopls/internal/analysis/modernize/cmd/modernize/main.go
deleted file mode 100644
index 0f1f5e6..0000000
--- a/gopls/internal/analysis/modernize/cmd/modernize/main.go
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2024 The Go Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style
-// license that can be found in the LICENSE file.
-
-// The modernize command suggests (or, with -fix, applies) fixes that
-// clarify Go code by using more modern features.
-//
-// See [golang.org/x/tools/go/analysis/passes/modernize] for details.
-//
-// Deprecated: use 'go run
-// golang.org/x/tools/go/analysis/passes/modernize/cmd/modernize' instead. In
-// due course the modernizer suite will be accessed through "go fix";
-// see https://go.dev/issue/71859.
-package main
-
-import (
- "golang.org/x/tools/go/analysis/multichecker"
- "golang.org/x/tools/go/analysis/passes/modernize"
-)
-
-func main() { multichecker.Main(modernize.Suite...) }

Change information

Files:
  • M go/analysis/passes/modernize/doc.go
  • D gopls/internal/analysis/modernize/cmd/modernize/main.go
Change size: S
Delta: 2 files changed, 7 insertions(+), 22 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I5b27787b3afdaf86c5c1222b3cc02ab45c138a38
Gerrit-Change-Number: 804000
Gerrit-PatchSet: 1
Gerrit-Owner: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Alan Donovan (Gerrit)

unread,
Jul 21, 2026, 10:03:37 PM (5 days ago) Jul 21
to goph...@pubsubhelper.golang.org, golang-co...@googlegroups.com
Attention needed from Alan Donovan

Alan Donovan uploaded new patchset

Alan Donovan uploaded patch set #2 to this change.
Open in Gerrit

Related details

Attention is currently required from:
  • Alan Donovan
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newpatchset
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I5b27787b3afdaf86c5c1222b3cc02ab45c138a38
Gerrit-Change-Number: 804000
Gerrit-PatchSet: 2
Gerrit-Owner: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
unsatisfied_requirement
satisfied_requirement
open
diffy

Alan Donovan (Gerrit)

unread,
Jul 21, 2026, 10:04:33 PM (5 days ago) Jul 21
to goph...@pubsubhelper.golang.org, Hongxiang Jiang, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com
Attention needed from Hongxiang Jiang

Alan Donovan voted Auto-Submit+1

Auto-Submit+1
Open in Gerrit

Related details

Attention is currently required from:
  • Hongxiang Jiang
Submit Requirements:
  • requirement is not satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
  • requirement is not satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I5b27787b3afdaf86c5c1222b3cc02ab45c138a38
Gerrit-Change-Number: 804000
Gerrit-PatchSet: 2
Gerrit-Owner: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Attention: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Comment-Date: Wed, 22 Jul 2026 02:04:28 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
unsatisfied_requirement
satisfied_requirement
open
diffy

Hongxiang Jiang (Gerrit)

unread,
Jul 24, 2026, 2:17:37 PM (2 days ago) Jul 24
to Alan Donovan, goph...@pubsubhelper.golang.org, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com
Attention needed from Alan Donovan

Hongxiang Jiang voted Code-Review+2

Code-Review+2
Open in Gerrit

Related details

Attention is currently required from:
  • Alan Donovan
Submit Requirements:
  • requirement satisfiedCode-Review
  • requirement satisfiedNo-Unresolved-Comments
  • requirement satisfiedReview-Enforcement
  • requirement satisfiedTryBots-Pass
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I5b27787b3afdaf86c5c1222b3cc02ab45c138a38
Gerrit-Change-Number: 804000
Gerrit-PatchSet: 2
Gerrit-Owner: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Hongxiang Jiang <hxj...@golang.org>
Gerrit-Attention: Alan Donovan <adon...@google.com>
Gerrit-Comment-Date: Fri, 24 Jul 2026 18:17:33 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
open
diffy

Gopher Robot (Gerrit)

unread,
Jul 24, 2026, 2:19:03 PM (2 days ago) Jul 24
to Alan Donovan, goph...@pubsubhelper.golang.org, golang-...@googlegroups.com, Hongxiang Jiang, golang...@luci-project-accounts.iam.gserviceaccount.com, golang-co...@googlegroups.com

Gopher Robot submitted the change

Change information

Commit message:
go/analysis/passes/modernize: document 'go fix' command

Update the modernizer docs to recommend go fix in preference
to the the multichecker-based modernize command.

Also, delete the gopls/internal/analysis/modernize/cmd/modernize
command, which is internal and deprecated. This will break
'go run .../modernize@latest' at the next gopls release.

Fixes golang/go#80510
Change-Id: I5b27787b3afdaf86c5c1222b3cc02ab45c138a38
Files:
  • M go/analysis/passes/modernize/doc.go
  • D gopls/internal/analysis/modernize/cmd/modernize/main.go
Change size: S
Delta: 2 files changed, 7 insertions(+), 25 deletions(-)
Branch: refs/heads/master
Submit Requirements:
Open in Gerrit
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: merged
Gerrit-Project: tools
Gerrit-Branch: master
Gerrit-Change-Id: I5b27787b3afdaf86c5c1222b3cc02ab45c138a38
Gerrit-Change-Number: 804000
Gerrit-PatchSet: 3
Gerrit-Owner: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Alan Donovan <adon...@google.com>
Gerrit-Reviewer: Gopher Robot <go...@golang.org>
open
diffy
satisfied_requirement
Reply all
Reply to author
Forward
0 new messages