IDE for Go capable of refactoring: variable, function, structure and package renaming

automated-refactoring, go, ide, refactoring, renaming

Solution

If you're interested in a script, use gofmt with `-r` flag. Like this:

gofmt -w -r 'OldFoo -> Foo' foopackage

From the docs:

Without an explicit path, it processes the standard input. Given a file, it operates on that file; given a directory, it operates on all .go files in that directory, recursively. (Files starting with a period are ignored.) By default, gofmt prints the reformatted sources to standard output.

EDIT: Today there are better tools for that: gorename for renaming and eg for general refactoring.

Problem

I am interested in any IDE (or even a script) that is capable of refactoring Go source code for variable renaming. For example in Eclipse for Java, one can select a variable, an object or a class, then to rename it and it gets automatically renamed in all the files in the project. This feature is very useful if automatic string replacement may cause substring collisions.

Original source