But what is the selling point for Go? I get that it is allegedly hailed to be a simple language with basically no batteries included, but why is that a selling point? Does Go excel at anything no other language does?
But what is the selling point for Go? I get that it is allegedly hailed to be a simple language with basically no batteries included, but why is that a selling point? Does Go excel at anything no other language does?
No batteries!? Go has a huge stable standard library no other language even comes close to. Built in tooling for unit testing, performance testing, debugging, code formatting, package management, etc. And most go binaries can be compiled statically so libc is not even a dependency. Golang is the definition of batteries included.
>Go has a huge stable standard library no other language even comes close to
Well, Java and Python do.
Yet the first thing most people do before making a HTTP request is pip install requests
Yet, a nicer request wrapper is not the be all end all of batteries, and Python covers a huge spread of libs
> Go has a huge stable standard library no other language even comes close to.
Java, C#, Python, Node.
Go has a very full featured standard library.
It's simple (do you really ask why that's a selling point?)
It's fast to compile.
It's fast to run.
It's good with parallelism.
It has myriads of examples, and LLMs can pick it up well too.
It has good backing.
It has good tooling.
It's fun.
It statically compiles to a trivially deployable binary.
It's excellent at cross compiling.
It has good adoption.
1. It has first-class co-routines, so supports high concurrency without having to deal with async bullshit
2. It produces a dependency-less statically linked binary
3. Duck typed interfaces give you static typing with minimal ceremony. They are implemented even for types outside your own code base, which is a common pain point in Java or C#.
4. It compiles quickly
I really don't like the lang itself but nobody will deny it has a very strong ecosystem and stdlib for handling around 95% of many well-solved problems you are likely to encounter.
I picked Go because it tends to use fewer resources than Node.js, and startup time is quite fast.
For one thing it’s statically typed and has many fewer foot guns than Python, so the llm-produced code is more likely to do what you expect.
Go is statically typed but the type system leaves much to be desired.
Go’s benefit are primarily around simplicity, readability, and concurrency.
>Go is statically typed but the type system leaves much to be desired.
Not that much. Looking at Rust or Haskell complexity, I don't really desire it.
Python has much better type system than Go, I don’t know what you’re on. With Trio it has a better async capabilities too.
Performance? Second only to rust and other lower level langs. Surely you don't need this spelled out for you...
Not just performance, but static typing and prevalent in the training data/easy for LLMs to reason about.
Of course, your response admits, "second to Rust", which I am guessing is an unspoken question in the grandparent's mind.
Java and C# are there and faster.
Yes, but kids these days only consider JS, Python, Rust and Go.
If performance is the main difference, whatever that means, then basically Go should be reserved for when Rust and other lower level langs cannot be used due to some other constraint? Are we mainly talking about performant Web backends?
Say I am building some app that I know will be CPU-bound, why choose Go over say... Swift?
>If performance is the main difference, whatever that means, then basically Go should be reserved for when Rust and other lower level langs cannot be used due to some other constraint?
Or when performance is the main but not the only difference, and there are many other benefits.
>Say I am building some app that I know will be CPU-bound, why choose Go over say... Swift?
Because unless you're building for macOS/iOS, Swift is really a no-go, with lackluster support for other platforms. Plus slow to build and convoluted.
> why choose Go over say... Swift?
Language religious wars are silly: you should choose a language based on your constraints and personal tastes. If there's no clear advantage of one language over another for a given task - then all the options are viable, pick one and get on with solving the problem.
>I get that it is allegedly hailed to be a simple language
That might be its core feature if you do agentic coding.
I think that’s sort of the selling point no? It’s really boring. It has like -10 keywords, compiles insanely fast, and has a concurrency model that’s easy to use and read. LLMs are great at using Go tooling to sanity check along the way. It’s easy to write shitty Go but it’s really pleasant to work with if you find those things compelling.
don't you worry about garbage collection?
If you were using Python, then probably not.
haha exactly. I’m coming from Swift, and I don’t want to go back to manually releasing objects like I used to in ObjC, let alone reason about lifetimes.
What's the big issue with GC nowadays? It has mattered to me exactly once in decades and it was still manageable anyway by using a more low level style in a hot loop. I see very few usecases where GC actually matters and for those rare few cases it was not like you were using python beforehand anyway
Why the hell would he "worry about garbage collection"? That kind of thing is a cargo cult fear.
Garbage collection is not an issue for 99% of programs. And for those that it is, there are ways to mitigate the issue (e.g. there are extremely high performance trading system written in Java, where every last sub-millisecond counts).
Blanket fear of GC reminds me when new programmers learned about how assembly is lower level and can be faster, and wondered why everything is not written in assembly.