Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
GitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
cmd/gofmt: ignore wildcards in gofmt -r #7870
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.