As most things in computer science (and life), there are multiple ways of achieving the same result, in regards to immutability it is not different. You have to consider it as another tool in your toolkit and use what works best for each issue you face. One very strong use case for immutability is when you are working with concurrent programming. Golang was designed with concurrency in mind, so it’s very common to use concurrency in go. Check this article if you want to read a bit about Golang’s concurrent model.

Here’s how you can use some immutability concepts in Golang to make your code more readable and stable, regardless of the paradigm you are using.


Immutability in Golang
1.40 GEEK