Why Do People Use Go ?Go golang why
People use Go programming language For various reasons. Here is all reasons in brief:
Go is open-source but backed up by a large corporation (Google)
- to learn
- to build up
- to compile
- to arrange and install
- to scamper
Go is a modern language
Go is Simple
It is Concurrent
Static code analysis
Garbage collected language
And now, let’s dive in each reason.
Concurrency has become one of toughest problems of modern programming, especially when it comes to networking software. Go was designed with concurrency and multi-core systems in mind. It’s not a revolution in concurrent programming but Goroutines and channels make concurrency way easier to handle! People coming from single-threaded environments are advised to learn the basic concepts of multi-threaded programming (data races, locks, lock-contention, lock-free structures, etc.) before even touching goroutines but they usually pick it up relatively quickly with Go because you usually can’t even get around it.
Simplicity and consistency as core language features
Go was designed to avoid hidden complexity and keep code consistent and straightforward. I’ve seen people ditch large C++ codebases and rewrite the whole thing in Go because the C++ code became unmaintainable at some point while Go code tends to remain maintainable over time at a very slight cost of runtime performance (compared to C++). It’s very common for people who initially started a thing to leave the company afterward and this can sometimes be a serious problem for codebases written in languages like C++ because of the diversity of these kinds of ecosystems. Go is a rather conservative language when it comes to features, code-style, and syntax-sugar making it one of the easiest languages to maintain codebases in.
No hidden complexity (no operator overloading, no function overloading, no setter/getter magic, no preprocessor, no const-expressions, no JIT-compilation, no abstract data-types, no implementation-inheritance, .. etc.)
No generics (Don’t get me wrong, generics aren’t bad, they’re actually pretty useful in some cases but their absence does make code more simple often than not)
A consistent code-style across the entire ecosystem (gofmt)
Strong static typing (IMHO, strong static typing makes code simpler because it makes violating constraints rather difficult making code easier to read, test, change and refactor)
A programming language needs more than just a good design and a good compiler to be able to become relevant in the market. The toolset is essential to make a language successful and give people enough confidence to write production-grade stuff in it. Go comes with an excellent set of tools right out-of-the-box:
- The gofmt code formatter
- A data-race detector
- An excellent standard library
- The automatic GoDoc documentation hosting
- The Go Playground
- An execution tracer
- A built-in profiler
- Built-in benchmarking
- A huge number of community-maintained packages
- Several static code analysis tools like Go vet and golang-ci lint
- Goland, a Go-focused IDE
- The VSCode Go-plugin
- Several CI/CD systems which are free for open-source projects
The fact that Go is not just designed and implemented by honored people like Ken Thompson but also backed and used by Google makes it easier to convince businesses to use Go in production. Go 1 keeps the backward compatibility promise and takes it seriously which makes it suitable for production-grade code.
Ecosystem & Community
There’s a list of companies using Go but I think even though it’s relatively well maintained it’s still far from complete. The number of Go developers around the world is counted in millions and Go’s ecosystem is steadily growing. There’s plenty of material to make it easier for people to get started with Go like the Tour of Go, Go by Example and similar.
Most errors occur in unverified or complex code. Go provides convenient tools for testing. In addition, strict typing eliminates errors like a random comparison of the number of apples with the number of pears, which are determined at the compilation stage.