newGoFileHeader option allows toggling automatic insertion of the copyright comment and package declaration in a newly created Go file.reflecttypefor analyzerThe new reflecttypefor modernizer simplifies calls to reflect.TypeOf to use reflect.TypeFor when the runtime type is known at compile time. For example, reflect.TypeOf(uint32(0)) becomes reflect.TypeFor[uint32]().
newexpr analyzerThe newexpr modernizer finds declarations of and calls to functions of this form:
func varOf(x int) *int { return &x }
use(varOf(123))
so that they are transformed to:
//go:fix inline func varOf(x int) *int { return new(x) } use(new(123))
(Such wrapper functions are widely used in serialization packages, for instance the proto.{Int64,String,Bool} helpers used with protobufs.)
iterators analyzerThe iterators modernizer replaces loops of this form,
for i := 0; i < x.Len(); i++ {
use(x.At(i))
}
or their “range x.Len()” equivalent, by
for elem := range x.All() {
use(x.At(i)
}
for various types in the standard library that now offer an iterator-based API.
The Rename operation now treats Doc Links like identifiers, so you can initiate a renaming from a Doc Link.