GoLang discussion series — The beginning
Hello all.. in recent days i got a chance to explore new programming language. Any programming language which comes into industry and pick-up some momentum to grab developers attention would last for long time. Demand for language may be fluctuating based on changes in IT but the code written to solve existing use cases and minimum user community who will continue like the language will last forever.
After many years of working in Java, i wanted to pick a language which is much powerful than Java and solve much bigger landscape of business problems in IT. An interesting factor to consider based on the history of most popular programing languages is simplicity and learning ease. This would help develop code quickly to develop and automate smaller problems and test before making a decision to build large product using the language.
This motivated me to pick Golang as my next programming language to learn, develop and automate some of the use cases in my projects.
What is Go !
Golang is statically typed compiled programming language which was initially developed by engineers Robert Griesemer, Rob Pike and Ken Thompson at Google in 2009, later open sourced in 2012.
At the time of writing this post latest Go version is 1.18
Compiled: Golang is statically typed compiled language, it creates quick ready to run binaries so the programming execution would be faster to Interpreted languages like Python or bytecode languages like Java.
Unlike Python or Java Go binary does not require runtime dependency installed on the host to execute the code. Go binary will have lightweight runtime embedded, so it can run anywhere and do not require to manage runtime in the host server.
Built-in concurrency: Great language strength comes from speed at which it can solve the problem. Golang has inbuilt concurrency using goroutines model which is much lightweight compared to Java concurrency. we can run thousands of goroutines in user space and let the go scheduler manage to communicate to OS green threads to achieve best concurrent execution. this model developed by keeping current multi core processes (hyperthreading). To complement concurrency Golang has channels to establish safest communication between Goroutines.
we will discuss more about this topic in coming articles ..!
Memory management: Developer do not have to worry about memory management, they can fully concentrate on writing clean and less code to address the business need in short time. Runtime takes care of allocating memory (thanks to statically typed code) and much efficient Garbage Collector (GC) can takes care of managing the memory while execution.
Performance: Golang is built to address some of the performance issues of processes at scale in Google company. all the benchmarks clearly shows Golang is much faster than python and Java.
Cross platform support: Using Go tools we can build binaries for different platforms quickly by setting GOOS and GOARC env variable while building the code.
/home$ go tool dist list
js/wasm/home$ GOOS=windows GOARC=amd64 go build .
Easy to learn: Golang is simple yet powerful language, we can learn the basics of language in couple days and start writing code to solve some of the critical problems. language itself has just 25 key words and it is less compared to Python (33+) and Java(65+). dev play ground
Developer community: My personal opinion is when we have passionate developers who can help others in solving problems at work. They will have more time to contribute back to the community to develop the best tool chain making opensource more powerful. Golang has very strong developer community with ready to help mindset.
Where is it used
Golang has been adopted in many places in IT as general purpose language and creating strong footprints in devOps, API, CLI, Data science and ML. hope to see maturity and better libraries in all these areas in near future !!
Infrastructure Management tools: Most popular Infrasture Management tools like Docker, Kubernetes, Terraform etc.. are developed using Golang.
Command line utility (CLI): We can build very nice CLI’s, cobra is one of the best libraries to develop large scale CLI.
RESTFull API: There are many libraries available in Golang to address some of the critical pinpoints in microservices architecture and establish fast communication. Some of the popular libraries are gin, beego, echo, goji and web frameworks like gorilla and neo.
gRPC: Golang supports gRPC. RPC(Remote Procedure Call) is back with more creative approach to fully utilize http2 protocol capabilities and establish fast and secured communication in microservices architecture.
Automation: Automation is very important to manage small-large scale applications. Golang’s simplicity, wide range of libraries and toolchain support develop automation process quicker.
we shall discuss more Golang features with examples in upcoming articles !!