Documentation ¶
Overview ¶
Fix finds Go programs that use old APIs and rewrites them to use newer ones. After you update to a new Go release, fix helps make the necessary changes to your programs.
Usage:
go tool fix [-r name,...] [path ...]
Without an explicit path, fix reads standard input and writes the result to standard output.
If the named path is a file, fix rewrites the named files in place. If the named path is a directory, fix rewrites all .go files in that directory tree. When fix rewrites a file, it prints a line to standard error giving the name of the file and the rewrite applied.
If the -diff flag is set, no files are rewritten. Instead fix prints the differences a rewrite would introduce.
The -r flag restricts the set of rewrites considered to those in the named list. By default fix considers all known rewrites. Fix's rewrites are idempotent, so that it is safe to apply fix to updated or partially updated code even without using the -r flag.
Fix prints the full list of fixes it can apply in its help output; to see them, run go tool fix -help.
Fix does not make backup copies of the files that it edits. Instead, use a version control system's “diff” functionality to inspect the changes that fix makes before committing them.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Type ¶
type Type struct { Field map[string]string // map field name to type Method map[string]string // map method name to comma-separated return types (should start with "func ") Embed []string // list of types this type embeds (for extra methods) Def string // definition of named type }
Type describes the Fields and Methods of a type. If the field or method cannot be found there, it is next looked for in the Embed list.
type TypeConfig ¶
type TypeConfig struct { Type map[string]*Type Var map[string]string Func map[string]string // External maps from a name to its type. // It provides additional typings not present in the Go source itself. // For now, the only additional typings are those generated by cgo. External map[string]string }