11 ms·
Coming from the C# and JVM world to go, tooling looked like one of the worst parts of Go. The debugging story is very limited: - No function execution - No e
by tsimionescu 7y ago
Coming from the C# and JVM world to go, tooling looked like one of the worst parts of Go.
The debugging story is very limited:
- No function execution
- No edit-and-continue
- No conditional breakpoints
- No watchpoints
Package management works OK on the consumption side, though it is much more clunky than with classic package managers (e.g. set an ENV variable to get a custom proxy, but write something in go.mod file to get a per-package proxy). However, the publishing side is all over the place:
- Relies on source-control integration
- Horrible import paths for packages published from large repos
- Versioning based on source-control tagging, exact format undocumented
- Major version changes require source-code level changes in all files touching the package
- Multiple Go modules in same repo use-case is not documented (can you have separate versions from same commit? how do they reference each other?)
The source-code level tools/plugins available are extremely basic (except for GoLand):
- No refactoring support other than "rename variable"
- Reference-finding across modules rarely seems to work
- No way to automatically find all implementations of an interface - especially problematic in a language with implicit interface implementation
- The tools are pretty slow, constantly re-parsing large chunks of code; go pls has fixed some of that
- morrbo 7y agoThis nailed it for me. I came back to write some go last night after not writing it for a long time. The modules, go dep, etc stuff really put me off. Whereas beforehand (been writing stuff for a few years, not hobbyist, just not super complex) it was intriguing..now it seems like they've just moved on in one direction for packages. However, that direction is not really super well documented, intimidsting, and sure as hell doesn't work as well as nuget or npm.
- Meai 7y agoGo also doesn't compile as quickly as people make you think. A regular sized project will compile more slowly than a similar sized c# project.
- vbezhenar 7y agoDo you compare it with C# AOT compilation?
- atilaneves 7y agoWhy would you?
- vbezhenar 7y agoBecause compiling to executable machine code and compiling to abstract high-level bytecode is a completely different things.
- coldtea 7y agoIt's part of Go's typical "we assume/declare that we do better/simpler without checking what/how other languages do" schtick. Take error handling and package management for example - different approaches, hacks piled, etc, instead of just going with the program, seeing how others do it successfully (e.g. Maybe/Optional error, exceptions, etc), and get on with it...
- throwaway34241 7y agoDo you think Go's developers and users are simply unaware of exceptions, optionals etc? Or is it that the trade offs that they made aren't net positive for most use cases? Even if the second was true, that isn't necessarily a bad decision; since C# continues to exist, there may be more use for a language targeted to some niche than just a copy of C#. I've used C# and Go extensively and like both languages. In some big ways they are similar: garbage collected, (fairly) fast compile times, large ecosystems, good tooling (if you include the JetBrains tooling for Go), built in lightweight concurrency, etc. It's not surprising people compare them. For the areas where they differ, Go in general is more explicit and more low level. Handling errors as return values instead of exceptions is more typing, but I find it easier to check that error handling has been done correctly in my own code and in third party libraries. Instead of the class/struct dichotomy pointers are explicit and any type can be used as a value type (there's also more flexibility in using Go types with unmanaged memory, and the ability to take interior pointers). The way interfaces are implemented they can be used in more places without boxing. C# has generics but I've run into frustrating limitations with them, for example not being able to write numeric code that works with either 32 bit or 64 bit floats. Go's generics are currently limited to some built in types but the proposals being iterated on seem like they'll be more useful to me than C#'s implementation if they make it into the language. Other things: Go has a single concurrency story so the ecosystem isn't divided into sync/async worlds, is a less complex language overall, and is a bit less verbose aside from error handling (no public static void etc). Overall I probably prefer Go, but I like C# also and could easily imagine projects where it might be a better choice especially in areas where the lower level aspects of Go aren't useful. Reading HN, it seems like a lot of people believe that people who use Go (and even the language designers) are simply ignorant. I'm open to the possibility, but can you flesh it out for me a little bit more? What am I missing here?
- Thaxll 7y agoProof? have you tried to compile Kubernetes and compare that to a 1M lines C# project?
- ovi256 7y agoImagine how much worse other popular programming languages' tooling is, given Golang is constantly praised as having great tooling. When integrating into a new dev team, half the work is grokking their local tooling choices. In an ecosystem with strong "one best way to do it" tooling, that effort is almost non-existent.
- tsimionescu 7y agoBut then, that is the question : which language is that? C# and Java are not it. C and C++ have excellent dev tools and debuggers, though it's true package management is essentially non - existent. Python, JavaScript and TypeScrpit have better tools than Go, even with the limitations of a dynamic language (the package ecosystem of npm is horrible, but npm itself is a pretty decent tool, definitely much simpler than go mod).
- richardwhiuk 7y agoRusts tooling is pretty stellar.
- NanoCoaster 7y agoDepends. Package Management, compiler errors? Absolutely. IDE support? Not so much. I don't think it's fair to compare it to C# / JVM languages, but even compared to other languages, I wouldn't say the tooling is all that great. Macros make IDE support a lot harder than in other languages, the atrocious compile times sure do as well. While IntelliJ Rust and rust-analyzer both try to do their best (kudos to the teams working on them!), it's still nowhere near anything I'd call "stellar". There are mitigations being worked on right now, like compiling macros to WASM[0] and Cranelift[0], but these endeavours, while very promising, I wouldn't call production-ready yet. [0] https://github.com/dtolnay/watt https://github.com/dtolnay/watt [1] https://github.com/bytecodealliance/cranelift https://github.com/bytecodealliance/cranelift EDIT: Also, debugging. I'm not sure of the current state of it, but last time I checked, it was pretty much just GDB integration that was working. CLion (which I think uses GDB?) is able to give you a nice UI for basic debugging, don't know about VSCode integration. Still, even if it works, it's not at all comparable to debugging in C#/JVM, you're limited to very basic stuff compared to these languages / the well-known IDEs for them. So, again, it may be "fine" or even "good", but imho it's not exactly stellar :)
- kitd 7y agoNo way to automatically find all implementations of an interface - especially problematic in a language with implicit interface implementation This is fundamentally a problem with duck typing, and it creates a massive amount of cognitive effort when trying to understand an unfamiliar code base. I don't have the qualms you have about the rest of the Go tooling, which is pretty good IMHO. The fact that it comes out of the box is a significant bonus too.
- tsimionescu 7y agoI understand duck typing of interfaces to types imposes some limitations, but it is by no means an absolute limitation. Given a set of Go source files, you can absolutely automatically find all types in those source files which match an interface. Sure, there could be implementations in other places as well, but the same is true for Java or C# or C++. Also, note that the compiler already does this check whenever you try to use some type as a specific interface type, this is not dynamic binding at runtime.
- kitd 7y agoI understand that, but it means I need to rely on tooling (which has limitations) to do something that is zero-effort in other languages, and that impedes easily understanding unfamiliar source code. It's not so much "Which types implement this interface", but rather "Which interfaces does this type implement". For this reason, I'm not at all convinced that duck typing contributes to the fundamental need to write easily understandable and maintainable code. What does it add, or what problem is it trying to solve? One commenter recently suggested putting, eg: var _ MyInterface = MyType{} at the top of the file to assert explicitly the interface implementation. This works but is a bit of a hack. Duck typing is my main gripe about Go, but generally I like it very much, and find it very practical, especially (funnily enough given the article) it's tooling.
- xyzzy_plugh 7y agoOddly enough I've never needed to look up "what implements this interface" in Go. I've been writing Go professionally in a senior/team lead roll for over 4 years. Usually I know what implements a given interface, as in the package I'm writing, I know what I've imported. Packages are usually small/narrow enough that there isn't ambiguity (i.e. I'm not reaching for some arbitrary implementation). The only pain point that comes to mind is the bytes, io, and strings packages where there are many common interfaces and many implementors, but it's never really headache inducing. The interface assertion you mention is useful for implementors to catch at compile time if they didn't implement a given interface (rather than find it at call sites), and catch where implementations break when an interface definition changes. You could put it in a test file, if you like, for the same effect.
- Groxx 7y agoI agree 100%, and I pretty strongly dislike Go's tooling because of it. Especially due to the horrible debugging options (though something is far better than nothing, of course). I've bashed my head against every single item in your list multiple times, and they've made extremely little progress over the years so I'm quite pessimistic about them changing. Though for completeness, what it does have that I find very useful, and has had from early days: - pprof for cpu (tunable sampling rate) and memory allocations (sampling and I think tracing) - a standard build system (as annoying as it can be (GOPATH, no file-as-input-list, etc)) so builds are indeed generally very simple and consistent: `go build .` (plus `glide install` or `dep ensure` in many cases, but that's easy too) - race detector (trivially catches an incredible amount of issues in less-than-highly-skilled code, which is the vast majority that I interact with) - `go fmt` spawned a whole ecosystem of "autoformat ALL the things" tools - (I personally don't give them credit for vendor, as vendoring was a thing the community hacked together for years before they finally half-supported it, though now it's great. GOPATH should have died that day, but alas...) .... though that might be my complete list tbh. And yeah, Goland's tooling is miles ahead of everything else, refactoring and find-usages is dramatically more accurate than all other tools I've tried. --- Many of those have been built (far more powerfully) for other languages, but part of the "go has good tooling" claim is that it has those out of the box. It's nowhere near enough to be "great" IMO, though modules get it much closer, but it gets a "good job" sticker on at least a few things even if the whole isn't particularly impressive.
- lm28469 7y ago> Coming from the C# and JVM Not that I disagree with you but comparing C#/JVM to go is like comparing a commercial airliner to a single seat monoplane. These projects are diametrically opposed from the get go in every way I can think of. There are only two languages I ever liked working with C and go. Because they're simple, full of compromises, but simple. I can't say that of C# or java, you probably need a PhD just to be able to use 1/3 of c#/java tooling and IDE features.
- tsimionescu 7y ago> I can't say that of C# or java, you probably need a PhD just to be able to use 1/3 of c#/java tooling and IDE features. That is absolutely incorrect. The whole point of having tooling at your disposal is to make the process of writing and reading code dead simple. Ypu don't need a PhD to pause the debugger, edit some code, hit continue, and have the new code executing. You don't need a PhD to select some text, click Extract Method (or press the shortcut), type in the method name, and have the new method/function on the screen. By the way, C has excellent tooling on all of these sides as well - C IDEs and debuggers are extremely powerful, unlike Go.
- rob74 7y agoYes, _commercial_ C (an Java) IDEs are extremely powerful, but it's a bit unfair to compare them to _open source_ Go IDEs/editors. From what I heard, the only commercial Go IDE available so far (GoLand) is extremely powerful too...
- BoorishBears 7y agoNot that I buy this argument in the slightest but: https://code.visualstudio.com/docs/languages/csharp https://code.visualstudio.com/docs/languages/csharp (Are you going to say, it's unfair to compare something with the commercial backing of Microsoft, because Google backs Go)
- imtringued 7y ago
- aquadrop 7y agoGoLand solves many problems though, for example they have conditional breakpoints and function execution in debugger (though not that powerful). And code refactoring/navigation is also pretty good.
- chewxy 7y ago> No way to automatically find all implementations of an interface - especially problematic in a language with implicit interface implementation C-c C-o-i (go-guru-implements)
- tsimionescu 7y agoGo guru is extremely slow, go pls is faster but doesn't implement this (yet, hopefully). Having multiple incomplete tools that do the same thing in the official tooling is another problem with Go tooling.
- ojosilva 7y agoI wonder what the future of package management will be. The author of the Node-revamp language Deno (https://deno.land https://deno.land) chose to basically follow a strategy not unlike Go and forego package.json and similar dependency manifests, while also adding things like explicit network access flags to prevent, I believe, NPM-type package hacking vectors.
- Already__Taken 7y agoI just don't see what deno is going to build with access flags that couldn't be solved by writing off local code and wrapping everything npm does into containers. There's nothing special to install in linux for a long time to use containers and once WSL2 is done, if it's made available to all windows either that or native containers it can just be the way npm works, managing containers.
- commandersaki 7y agoPretty sure `go guru' satisfies reference finding across modules/packages and finding all implementation of an interface. It is slow because go guru (and gorename) needs to search all packages in modules and GOPATH but it is also correct.
- nautilus12 7y agoAgree!
- socialdemocrat 7y agoRefactoring is a bit more advance than just renaming though. gofmt can transform one pattern to another. https://spf13.com/post/go-fmt/ https://spf13.com/post/go-fmt/
- goguy 7y agoAgree with a lot of that especially this part: > Major version changes require source-code level changes in all files touching the package I've always thought the tooling was half baked but would get there eventually. The introduction of modules has caused a split and put the tooling either further behind IMO.
- cle 7y agoIn my experience, the debugging story isn’t as bad as most think, because compilation times are so fast. If I need to run some code at a random location to see what’s going on, I just add it and rerun the unit test, usually it takes less time than configuring a debugger to do the same thing, and I’ve also now got a place to put a UT to cover whatever the problem was.
- tsimionescu 7y agoEdit-compile-rerun is as fast or slower in Go compared to Java, C#, Python, Ruby and many others, and it's still an option in those languages. Comparing to C, C++ or Rust, or, surprisingly, JS, instead, you're probably right. However, unit testing is not by any means a substitute for all uses of a debugger. You can add unit tests to reproduce an error in any language, but once your problems start crossing module boundaries, a debugger (or printf debugging at least) often becomes indispensable. And having an edit-and-continue debugger is extraordinarily helpful when dealing with bugs that only reproduce in complex application states (when your cycle becomes edit-compile-rerun-send50CommandsToPutAppInCorrectState-reproduce).
- Thaxll 7y agoThe worst? What exactly other language has: - built in race detector ( go build -race . ) - multi-platform / multi-os easy compilation ( GOOS=windows GOARCH=amd64 go build . ) <- you can even do that from your Rapsberri pi - very easy and powerful profiling with pprof - go fmt / go vet Yes it's not perfect but it's better than most languages so I woudn't be that harsh on tooling, especially since most of your issues are not related directly to Go tools (Packages publishing side ) and for the last part Goland works fine and is the most popular IDE with VSCode. Go overall has good tooling for a relatively young language compare to more matures ones like Java and C#.
- alharith 7y agoLet's not forget most of the good JVM tooling, especially early on in Java's history, was and is 3rd party and most cost money. Even today, it's still a sea of confusion, especially if you are new to all of this. For example if I search for "best JVM profiler", I get a list of 10 results all claiming some form or fashion of being "the best" or "most popular" As someone who spent the first half of their career on the JVM and now is mostly Go, I don't understand how someone who has been on the JVM most their life can say Go's tooling is "the worst" Most of the things you have to configure and tweak on the JVM and profile for aren't even considerations in Go, because they are either simply non-issues in Go, or don't exist (because Go does not have a virtual machine to begin with)
- tsimionescu 7y agoSure, but whether a tool is 3rd party or 1st party matters less if there is significant difference in the advantages that tool brings. Being free and/or open source is more important, but at least currently, there are many excellent free and open source Java tools in all the categories I mentioned. Also, I didn't say that Go's tooling is the worst. I said it's one of its worst aspects. I still miss Maven, jmap, VisualVM, and the Java debugger almost everyday, not to mention IntelliJ. > Most of the things you have to configure and tweak on the JVM and profile for aren't even considerations in Go, because they are either simply non-issues in Go, or don't exist (because Go does not have a virtual machine to begin with) I'm not sure what you are thinking of specifically here, but in general the same considerations apply between Go and JVM, it's just that Go doesn't allow you to tweak things like GC algorithms and parameters. JIT is the only other area where I remember spending time thinking about Java performance that is truly a non-consideration in Go, but Go has other performance considerations to worry about (pass by copy vs pass by pointer, number of system threads off the top of my head).
- nn3 7y agoYes it's always amazing how these new environment skimp on debugging support. After all that's the activity most of us doing real software spend the most time on, and no, no amount of "safe programming" will avoid debugging. I guess debugging is just not cool.