5 ms·
The thing I really miss about my C# days is the automated refactoring. How good are the available refactoring tools for golang?
by beck5 13y ago
The thing I really miss about my C# days is the automated refactoring. How good are the available refactoring tools for golang?
- ominous_prime 13y agoI haven't seen any yet (though I would probably not be one to use them), but the language lends itself to the creation of such tools very well. Between the basics like fmt, and easy assess to the AST, I don't think it will be too long before more advanced tooling comes out from some of the larger organizations using go.
- mbell 13y agoThere is some support via a plugin [0] for JetBrains Idea. I also wouldn't be surprised to see JetBrains put some internal effort into supporting Go, from what I've heard Idea is pretty popular within Google and they just switched their Android Studio over to an Idea base. [0] https://github.com/mtoader/google-go-lang-idea-plugin https://github.com/mtoader/google-go-lang-idea-plugin
- jweir 13y agoI am not familiar with C#, but what Go does have is gofmt. This forces all Go code to be formatted and styled in a consisten manner. This not only solves readability issues, but makes all code consistent for machine reading and replacing. gofmt also supplies a pattern replace method, which is a bit more sophisticated than a regex search and replace. http://golang.org/cmd/gofmt/ http://golang.org/cmd/gofmt/
- kvb 13y agoRefactoring is not reformatting, nor are text replacement systems comparable. Refactoring allows you to keep program behavior the same while safely making structural changes to your code. Renaming is one simple example of this (where true refactoring tools are superior to textual find-and-replace because they understand which occurrences of an identifier are semantically identical). But there are many other useful refactoring operations, such as extracting a bit of logic into its own method, etc.
- dualogy 13y agoIn addition to go fmt there's also the go fix command for that. For interactive refactoring experience, then, it's basically up to the IDE how to integrate that.
- trailfox 13y agoIs there even a decent IDE for Go?
- grey-area 13y agoIs there even a decent IDE for Go? If you want a language which requires an IDE, I doubt very much you'd like Go - it is intentionally pared down to a minimum of what the creators consider essential features. Having an IDE is almost required in a language where you have things like header files, namespacing, verbose function names, type hierarchies, a vast and complex standard library, etc. I've used a few IDEs, and prefer to go without where I can, though with some languages they're almost necessary - that's a personal judgement though, not a criticism of those who like IDEs or languages which require them. In Go, I can't imagine what I'd even use one for, save to organise the files in a project and do global searches, and perhaps trigger compiles/runs (I use a text editor for that), it's far closer to a scripting language in that sense. As to refactoring, it's really very simple and tools like gofix are there if you want to do something complex - to be honest that's really unnecessary for 99% of the refactoring I do, a search, check and replace does it very quickly. So you might not like the language for the same reasons it doesn't require an IDE, but not having a decent IDE is not a valid criticism on its own.
- kvb 13y agoI don't see how you make the jump from "Is there even a decent IDE for Go?" to "If you want a language which requires an IDE ...". For many people IDEs make the experience of programming more pleasant, even if the language is perfectly usable without an IDE. It hardly requires "a vast and complex standard library" for documentation tooltips or auto-completion to be useful, for instance.
- 13y ago