Learning to code:

GoLang

In my line of work, there hasn't been a real push to get to know a program language in great detail. I can think of early on my career where I spent some time script kidding with expect, dabbling a bit with AWK, and building some automation framework with BASIC (AutoIT). Yeah..... Old school stuff! I have spent a fair amount of time manipulating python scripts, and a bit of time messing with mark up languages.

At any rate, the network industry in the year 2020 seems to have a lot of momentum around python. Now, rightly so, as far as I can tell, its a fairly easy language to play with and there is an absolute wealth of help guides out there as it relates to coding for network automation and data science. The knock on python though seems to be that it has some inherent flaws with regards to its long game as code becomes more complex. Though this post is not a debate about what coding language is best! If you want to read into some details into the pros and cons of the language I found a pretty good blog post here as you begin your journey.


PROS: CONS:Performance Error handling Concurrency Package managementCompilationEcosystem

Where to start?

If I had to pick just one resource it would be "Learn how to code: Google's Go (golang) programming language" that is available at Udemy. Todd McLeod who teaches this course is very entertaining and walks you through a beginner to intermediate step-by-step guide of the language. The course itself will walk you through a laundry list of locations to seek external resources that aid in the understanding of the course. Its very well put together though and there are various practice stages to go through as you get exercises that map you to different ninja levels. Where it stand right now though I have just got through ninja level 6.

Set up ATOM

So if you spend a fair amount of time coding and already have an IDE (Integrated Development Environment), this may not help you. If you want a place to execute code as you walk through the exercises then head over to the ATOM website. This is of course the one I use, as I like how it integrates with the github and you can write code, stage, commit, and push to the site for reference. There are other IDE's, and in a section of the the Udemy course there is a video that is dedicated to just setting up an environment that works for you.

Projects with Go

One of the things I have found that really gets you invested in learning is finding a project to work on. There is absolute plethora of projects with network automation. If you are looking for one, head over to the Arista site and start looking at their Goeapi plugin. Pretty slick examples in here that go over how to automate and extract information through the API interface. Now if you wanted to really start digging into the realm of possibilities and find yourself down in the weeds you can head over to the godoc package site. There are a lot of other projects as well, just google something and get creative.

The beginnings

Since this is just the beginnings of learning a programming language I don't have a heck of a lot of resources or examples of actual problems encountered. I have however found a few python to Go library references that might be useful for those of us in the network developer line of work.

Python Requests == (Go) net/http {The built in net/http provides HTTP client and server implementations}Flask/Jinja2 == (Go) Gin {Gin is a HTTP web framework with a really simple API}CLI creation == (Go) Cobra {Cobra is both a library for creating CLI and a program to generate command files}

Last but not least, this guy has a great blog on learning the Go programming language with a lot of practical use case. Well, thats it for now...... As I start digging a bit more, will come back here with some Go examples (Maybe dataframes?)

-PC