- Anything that talks to a network (webservers, load balancers, caches - due to the fantastic built-in support for everything you eed, and concurrency primitives)
- CLIs (static linking and cross compiling make distributing binary CLIs a piece of cake)
- Gluing stuff together (it talks C, and all your favourite libraries are probably already available (gRPC, protobuf... etc)
- Munging data (expect orders of magnitude speedups over Python)
Go is bad at:
Why consider Go over other things?
- For me, Go is "the language with the least BS" there is. The "let's just get some engineers writing some code and ship it" story is literally miles ahead of Python/C++/Java/X language. It has been painstakingly crafted to minimise friction onboarding, building, testing, upgrading, and deploying.
1. The first time I had to design a concurrent module. Goroutines and channels are amazing. In most cases you still need to dress them up a bit, but the first class support makes it really easy to start simple and add as needed. In fact, as I type this I feel that that is a general theme of the language. It kind of urges you to start simple and iteratively improve things.
2. Cgo. Cgo has a lot of mixed opinions, but I am on a team with very few resources, so my output in terms of volumes of code is limited. I have been very thankful that I could both link in existing C dependencies into my project, and also build my project as a C library for other existing projects. This again, allowed me to start small, and slowly rewrite the important pieces in Go when it was worth it.
3. Pprof. That tool is amazing. There’s some really good YouTube demos of it so I won’t go into detail about it, but particularly for algorithms, this tool has helped me speed up certain parts of code by a few orders of magnitude, essentially making them practical for real world use.
4. The build system is fantastic and very fast (when compared to the aforementioned C / C++ projects)
There are definitely more reasons, but I love Go primarily because it feels like one of the most pragmatically thought out language that I’ve ever used. It has lots of tooling and features that make it fast to build working, robust, and fast software. It may lack some syntactic sugar and certain language features that allow you to make clean, gorgeous abstractions, but it’s a trade off that I care less and less about every day that I use Go.
How are pip/gem/npm materially different from something like apt-get or pacman?
Why do you feel so strongly about avoiding them?
The choice between writing the server in Objective-C or Swift, versus Go was easy. For servers, Go is a natural fit.
Beyond's front end is a traditional macOS Cocoa application but the hard work is all handled by a Go binary.
Further, the most common way to deal with errors in a webservice (frankly, in a lot of types of systems) is to have an outer error handler catch an exception, log the error and tell the user "oops, try again". Pain to achieve this in Go.
It's hard for me to come up with a type of system where Go is more ill suited given how much choice you have. Go for web services only makes sense if your workload is CPU bound or you need to throw cores at large block of shared memory (and you have your reasons for not wanting to use Rust or the JVM ). 99% of webservices are better off in Elixir, Node, Ruby, Python or even PHP.
Go's best use case is for CLIs.