This is a continuation of my article
An important information to note about go: The main func is actually a goroutine on it’s own, keep this in mind it’ll come in handy later on
Let me give a simple but a bit more intermidiate example of goroutines and channels in action:
Go is a concurrent programming language, to understand what concurrency is check here: https://ikeoha.com/post/concurrency-vs-parallelism-for-the-layman-my-people/
Go achieves this said concurrency with the use of goroutines.
Goroutines simply put are lightweight threads, what does this mean for you? Well it means that functions in go can easily run concurrently beside other functions. These goroutines are extremely lightweight, more lightweight than native threads, as a result of that, numerous goroutines can be spawned with little to no cost.
According to Wikipedia: Concurrency is the abililty of different parts of a program, algorithm or problem to be executed out-of-order or in partial order without affecting the final outcome. This can be easily confused with parallelism.