Introduction to Go Lang
3 Requirements to Get Going with Go Lang
I’ve heard a lot about how great of a language Go is. I’m a technology consultant by trade and that has exposed me to a variety of languages. It was about time for me to explore Go and see what all the hype was about. This is probably just a venture in being unproductive but what else is there to do on a Saturday? Catch up on yardwork? No way.
The hype around the language is real and from what I could tell, actually appeared to have merit. Go figure. (for more hype bashing see this article)
Here are my thoughts after working through 3 areas of learning a new language for someone who already has experience in some language. My background is primarily with scripted languages, so my perspective is coming from a scripted background.
The story behind Go sounds a lot like the story behind other languages. 3 guys who worked at big company MegaCorp wanted a more effective way to run and write programs so they created the next great language. You should use it so that you can have the best program on the block.
What I’m still looking for is things about how it utilizes threads/processes and some of the bones behind the actual execution environment. I find this information critical to any production deployment.
Their introduction is good but the website is a little bit difficult to read through. It reads a lot like java documentation from yesteryear https://golang.org/
Two unique things I noticed is that Go allows you to use pointers/references where needed which I think is pretty awesome. So by default, parameters and variables are passed by value.
The other unique thing is goroutines which allow for efficient multi-threaded behavior. The Go Tour is excellent for those who’ve already explored other languages.
I also walked through CodeAcademy which I’ve liked for other languages, but it is very light. I’d only recommend that if this is your first introduction to a language. You’ll probably need to pay for the pro version of CodeAcademy in order to get enough content to actually know the language
Generally speaking, breaking down the environment for a new language requires more time and effort. Especially to deploy the application in a production setting
Most languages have a package manager of some kind that ensures the workspace you are using has the correct dependencies. All of the languages I have used have the concept of having multiple workspaces on a machine. Each with their own dependencies scoped to the individual workspace. This is to help with the dreaded dependency hell
So, for example, if I were to create a project “webapp” and project “algorithm” in Python it would best practice to create a “virtual environment” for both projects. Each with its own set of dependencies/libraries. So, potentially the “webapp” and the “algorithm” project could use the same library and have a different version of that library. Maybe that’s coolpackage:v1.1 for the “webapp” and coolpackage:v1.3 for the “algorithm.”
That’s not the case for Go. Your machine is one workspace in Go and all of the projects and dependencies will all reside in this one workspace. Go figure!
This introduces some interesting assumptions from the makers of Go. There is NO dependency management in Go. You only pull/use the latest packages of other libraries. If you have to use an older version, you have to fork the project and pull it in separately on your own.
I highly recommend to anyone starting Go that they read this article which goes over this different approach to package management: https://github.com/alco/gostart. I am curious to see if I like or hate this approach. I believe this kind of choice to be one that polarizes.
So far, my limited experience with Go has been good. The support around the community is excellent and documentation is good enough. Go has been through a lot of polishing already and there are a lot of jobs and programmers out there who know the language. Having the support of Google also helps a lot. These are all other pieces that should be taken into consideration when deciding to learn a new language.
Good luck go’in!