You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
gofmt -r is what it is. I don't think we should start adding new things to it.
If we need a full-blown refactoring tool, it should be somewhere else.
code.google.com/p/go.tools/cmd/eg is one promising start.
The text was updated successfully, but these errors were encountered: