4 ms·
pretty even-handed. > The other day I had to make a bunch of fields public to satisfy Go's encoding package, and code needed to be updated everywhere with a ma
by zemo 11y ago
pretty even-handed.
> The other day I had to make a bunch of fields public to satisfy Go's encoding package, and code needed to be updated everywhere with a manual find/replace (the same string was used in other contexts too so it couldn't be done automatically)
gofmt has syntax-level replacements. So you could do:
`gofmt -w -r 'unexportedName -> ExportedName' *.go`
or something similar, and it would do the correct thing, ignoring the string matches where it appears in other contexts.
- Manishearth 11y agoThanks! I wish I'd known this a week ago, but I'll keep it in mind for the next time I'm poking at Go :)
- johncch 11y agoI use gorename http://gopkgs.com/doc/pkg/gopkgs.com/gc/go.tools/cmd/gorename http://gopkgs.com/doc/pkg/gopkgs.com/gc/go.tools/cmd/gorenam... and it works well with vim-go integration on vim for example
- blaenk 11y agoWe should really think about getting something like this in rust/rustfmt. Syntax-level replacements sound pretty awesome.
- libria 11y agoThis is why we need an IDE or Neovim + some epic plugins. Who's working on one?
- aikah 11y agothere is liteide already which does exactly that (right click on a symbol refactor->rename symbol under cursor)
- GhotiFish 11y agowell neovim might not be ready to go, but vim-go is a very nice suite of tools for vim.
- EugeneOZ 11y agohttps://github.com/go-lang-plugin-org/go-lang-idea-plugin https://github.com/go-lang-plugin-org/go-lang-idea-plugin
- shazow 11y agoAs far as vim goes, https://github.com/fatih/vim-go https://github.com/fatih/vim-go is the best all-in-one plugin. Really a pleasure to use and easy to install. Should work with neovim too.
- justinfx 11y agoI've had a pull request in to add support for GoRename, to the GoSublime plugin for SublimeText. Works great. https://github.com/DisposaBoy/GoSublime/pull/569 https://github.com/DisposaBoy/GoSublime/pull/569