Source file src/cmd/fix/main.go
1 // Copyright 2025 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 /* 6 Fix is a tool executed by "go fix" to update Go programs that use old 7 features of the language and library and rewrite them to use newer 8 ones. After you update to a new Go release, fix helps make the 9 necessary changes to your programs. 10 11 See the documentation for "go fix" for how to run this command. 12 You can provide an alternative tool using "go fix -fixtool=..." 13 14 Run "go tool fix help" to see the list of analyzers supported by this 15 program. 16 17 See [golang.org/x/tools/go/analysis] for information on how to write 18 an analyzer that can suggest fixes. 19 */ 20 package main 21 22 import ( 23 "cmd/internal/objabi" 24 "cmd/internal/telemetry/counter" 25 26 "golang.org/x/tools/go/analysis/suite/fix" 27 "golang.org/x/tools/go/analysis/unitchecker" 28 ) 29 30 func main() { 31 // Keep consistent with cmd/vet/main.go! 32 counter.Open() 33 objabi.AddVersionFlag() 34 counter.Inc("fix/invocations") 35 36 unitchecker.Main(fix.Suite...) // (never returns) 37 } 38