Learning GoLang


Why learn GoLang?

I like Python. I took to it much easier that I did with Javascript. But Python has its limitations. It is not the best language for performance intensive applications. GoLang, on the other hand, is designed for high performance and concurrency. It is a statically typed language that compiles to machine code, making it faster than interpreted languages like Python. So I thought I would give it a try. I did also look at Rust which is popular lately, but I asked AI using Perplexity which would be better and it seemed that Go would be easer than Rust for a beginner to pick up. I mean I am not a beginner but at the same time I’m not an expert coder either. I have looked at other languages like Dart and Swift because I can use those to make phone apps. I had most success in that direction with Flutterflow and not needing to use any code at all. I kind of found Swift to be quite incomprehensible once you get past the basics. Mind you, the basics of a language are usually pretty easy. Takes no time at all to learn variable and the If and other looping code. Functions are easy too to understand. But once you get into classes and objects and all that, it gets a bit more tricky.

Getting started with GoLang

There a lot of resources online to learn GoLang. The official Go website has a great tutorial to get started. I started with the basics, learning about variables, data types, and control structures. Then I moved on to functions, structs, and interfaces. I have yet to get into Go’s unique features like goroutines and channels for concurrency. Most interesting for me is to work out how to connect databases to Go applications. I have worked with SQL databases before using Python, so I am curious to see how it works in Go. I have also been looking at how to use Go for web development. There are several frameworks available, such as Gin and Echo, that make it easy to build web applications with Go. Gin is the one I have tried out so far and it seems pretty straightforward. Not as nice as using Django with Python. In fact I have not really found anything as comprehensive as Django for GoLang yet. But I am sure there are some good resources out there.

What about Using AI instead of learning GoLang?

Well, I have been looking at AI tools and making use of Copilot in GitHub to help me write code. It is pretty good at suggesting code snippets and completing code for you. But I think there is still value in learning a programming language yourself. Understanding the fundamentals of programming and how a language works will make you a better programmer overall. Plus, there are times when AI tools may not be able to provide the exact solution you need, especially for more complex problems. So I think learning GoLang is still a worthwhile endeavor. You do need to know what to ask the AI to do. Mostly I used Perplexity to find where I had made a mistake in the code. I paste in the code and it tells me where I went wrong, It is usually where I have mislaid a curly bracket or similar and it can be hard to spot where the mistake is. AI is just a tool and it doesn’t feel like cheating to me. It’s more like having a tutor to help you along the way.

Plenty of Resources to Learn Go

Apart from the official Go website, there are plenty of other resources available to learn GoLang. Here are a few that I found helpful: Go by Example I like this one because it begins with a list of all the things in Go and each links to a page which has code examples. Really handy to learn the go Syntax when you can see it in action.

Go by Example

For me, the best way to learn is by doing and following Youtube video tutorials. There are several channels that offer GoLang tutorials, such as JustForFunc: Programming in Go and Golang Cafe which is a bit dated, the videos being 4 years old. These channels provide practical examples and real-world applications of GoLang, which can be very helpful for beginners. I found the tutorials by Net Ninja the most useful and clear with the explanations of the code. He also has a set of tutorials on creating a microservice with GoLang. I have to admit I watched a couple of useless tutorials which were a waste of my time. That’s the way it goes with Youtube sometimes. You have to sift through the rubbish to find the gems.

Net Ninja Go Tutorials

Conclusion

I am happy that I decided to learn GoLang. It is a powerful language that is well-suited for modern applications. While it may not be as popular as some other languages, it has a strong community and plenty of resources available for learning. I am looking forward to exploring more of what GoLang has to offer and building some interesting projects with it. I like to see how I can use GoLang to create web applications and connect to databases. I will keep you updated on my progress and share any interesting projects I create with GoLang in future blog posts. In the past I used Python and I liked working with Django, Go doesn’t seem to have an equivalent framework yet, but I am sure there are ways to build web applications with Go. Watch this space!