5 ms·
Experienced Java and Go dev here. On formatting, gofmt is awesome. There's an IDE called LiteIDE which automatically calls gofmt for you, or you can just run
by jbooth 13y ago
Experienced Java and Go dev here.
On formatting, gofmt is awesome. There's an IDE called LiteIDE which automatically calls gofmt for you, or you can just run it yourself whenever. Additionally, because there's deliberately no room to customize gofmt, you don't have to spend time in pointless meetings when "that guy" decides it's time to rewrite your company eclipse templates and argue over all the minutiae.
As far as refactoring, nobody's built an IDE integration that comes close to eclipse/IDEA for that as far as I know. It's totally doable in Go, in a way that it wouldn't be for Python (yay types), but I don't think anyone's done it. On the upside, doing it manually is less painful than it would be in typical Java code, due to type inference and having less code to begin with.
- kasey_junk 13y agogofmt is the single biggest feature of Go that might make me try it out. Such a great idea, I wish every language would adopt it.
- nostrademons 13y agoA lot have: https://news.ycombinator.com/item?id=7600130 https://news.ycombinator.com/item?id=7600130
- michaelmior 13y agoThis isn't the same. Go defines a standard format for all code written in Go with nothing left up to programmer opinion. While a lot of great formatting tools exist for other languages, they require choices to be made which inevitably results in disagreement.
- to3m 13y agoIf you use C# in Visual Studio, you can press Ctrl+K, Ctrl+D to have the entire document reformatted. Surprisingly few people seem to know about this, judging by how often I've found myself using this on other people's source files and had everything shift around. (Or maybe I'm just unusual and everybody else has just played with the settings.) The reformatting is actually quite aggressive (it will add/remove blanks and move braces and bits of code around), and so does a good job of keeping everybody's code looking consistent. The Visual Studio text editing functionality only occasionally reaches even the lofty heights of "pretty good", but I do think the document reformatting actually even exceeds that. (Shame the settings are are per-user rather than per-project, but there you go. It wouldn't be Visual Studio if they didn't manage to fuck something up at the last moment.)
- dikei 13y agoEvery decent IDEs have a code formater, but not everyone uses the same IDE so its usefulness is limited. On the other hand, gofmt comes with the platform and make it easy to enforce a common standard between developers.
- ufo 13y agoThat said, I think that in C#'s specific case most developers should be using Visual Studio.
- sparkie 13y agoThe default Visual Studio formatting sucks - wasted lines for opening braces when we have limited vertical real estate. Visual Studio should support per-project, or per-solution formatting configurations, which can be placed into the source code repository to ensure everyone on the team is using the same settings - MonoDevelop already does this and it's really useful for switching between projects which use different formats.
- nahname 13y agoFour space tabs are like a splinter in my mind.
- wlll 13y agoThat suggests you don't understand what tabs are. Tabs are a single char, not x number of spaces. You can set your text editor to display tabs as any number of spaces you want, I set mine to two. See: https://www.youtube.com/watch?v=sln-gJaURzk#t=1735 https://www.youtube.com/watch?v=sln-gJaURzk#t=1735
- nahname 12y agoNo need to be pedantic. The choice is more that just trivial display in and IDE. For example, https://github.com/zenazn/goji/blob/master/goji.go https://github.com/zenazn/goji/blob/master/goji.go
- landr0id 13y agoI wasn't a huge fan of LiteIDE when I tried it. I prefer GoSublime[1] with SublimeCodeIntel[2], with goimports[3] for my gofmt command. The combo of the three is really awesome. [1] https://github.com/DisposaBoy/GoSublime https://github.com/DisposaBoy/GoSublime [2] https://github.com/SublimeCodeIntel/SublimeCodeIntel https://github.com/SublimeCodeIntel/SublimeCodeIntel [3] https://github.com/bradfitz/goimports https://github.com/bradfitz/goimports
- kyrra 13y agoWhat does SublimeCodeIntel provide that GoSublime doesn't already give you? GoSublime gives you Gocode support, so you have full auto-complete already.
- signa11 13y ago> There's an IDE called LiteIDE which automatically calls gofmt for you... or on emacs, if you use the packaged go-mode.el, you can run gofmt on the "before-save-hook" to do that for you...
- vanderZwan 13y agoI'm surprised nobody has mentioned gofmt -r yet. http://golang.org/cmd/gofmt/ http://golang.org/cmd/gofmt/