-
Notifications
You must be signed in to change notification settings - Fork 18.3k
Closed
Labels
Description
go version go1.2.1 darwin/amd64 I love the wildcard feature of gofmt -r, but it is also idiomatic to use single character identifiers in Go code. This makes it difficult to perform rewrites in certain cases. Suppose you have a file like http://play.golang.org/p/_6CvVWgy1v and you wanted to change only the instance of f.Write(). If you ran gofmt -d -r 'f.Write([]byte(x)) -> f.WriteString(x)', you would write both the f.Write() and g.Write() due to f being interpreted as a wildcard. I have a patch which adds a -i argument to gofmt to prevent one or more identifiers from being interpreted as a wildcard, which I'll submit shortly.