This month, I embarked on a journey to learn Golang, and I must say, it's proven to be quite an intriguing language. Are you curious about what I've learned so far? Perhaps you're wondering why I chose Golang? Well, in this article, I'll share my experience of learning Golang.
Why Choose Golang? π
Go, often referred to as "Golang," stands as one of the most popular programming languages globally. Despite its relative youth, it boasts a thriving and extensive community. So, what makes Golang so popular? People praise it for being easy to learn, lightning-fast, and incredibly lightweight. This prompted a burning question in my mind: "Is this reputation well-deserved?" Consequently, I made the decision to dive into Golang and uncover the answers.
How I Went About Learning Golang π
I kicked off my Golang journey by watching several YouTube videos that demonstrated the development of a REST API server using Go. As a backend developer familiar with JavaScript, this approach felt like an excellent starting point. As I delved deeper into these videos, I noticed striking similarities between Golang and C. While the syntax resembled that of JavaScript and Pythonβsimple and intuitiveβthe method of declaring variables felt reminiscent of C, albeit with a more straightforward approach. It became evident that Golang shared common ground with C in areas like struct declaration for modeling, function declaration, and variable usage, including pointers and more.
Following this, I proceeded to set up my development environment for Golang and embarked on creating my first project: a straightforward URL shortener aptly named "Go-Shorter." Armed with the insights gleaned from my video tutorials, this hands-on experience proved invaluable. As a proponent of "learning by doing," I found this a fantastic way to grasp project creation, package development, function creation, and utilizing packages created by others.
What I Achieved This Month π
In just one month, I successfully birthed two Golang projects:
- Go-Shorter: A minimalist URL shortener, crafted using Go, Gin, MongoDB, and Redis.
- JKT48-Showroom-CLI: A versatile CLI tool designed for watching and monitoring JKT48 Showroom live streams.
Remarkably, I managed to accomplish this amid the hectic backdrop of college assignments and work commitments. This can be attributed to Golang's striking resemblance to languages I'd previously encountered, along with the unwavering support of the Go community. Whenever I faced questions or challenges, solutions were readily available online or with the assistance of ChatGPT.
In Conclusion π
After a month of intense learning, my verdict on Golang is highly positive. Its echoes of C, coupled with its straightforward syntax, have made my learning journey not just educational but also remarkably comfortable. The extensive and helpful community has played a pivotal role, making it easy to find answers to my queries. However, in terms of its touted speed and lightweight nature, I believe there's still more exploration to be done. Consequently, I'm committed to continuing my Golang journey and conducting further research.
Please feel free to share your own experiences with learning Golang in the comments below. Thank you for taking the time to read this article, and I look forward to connecting with you in future pieces. ππ
Top comments (26)
I've learned Go throughout 2022 and I tell you this: the language is simple, not easy. Its syntax strives to be the bare minimum you need to get going and I stick to its philosophy whenever possible even in other languages. It's really useful for straight scripting and prototyping. But sometimes I fell like the "forced simplicity" it forces on you is a bit limiting.
What's really challenging for me is the lack of some commodities and similarities provided by other languages, for example enums and common error handling via exceptions. I enjoy handling errors locally and it makes sense in small testable functions, but error wrapping and the extensive "if err != nil" throughout the entire code base is a bit tiring sometimes. Contexts are painful too. Also, what could be a simple class in other languages tends to be a little more code and a little bit less readable in Go, given the "struct and functions with receiver" pattern is not that visually clear compared to a class. Another slight inconvenience is that a struct can have its methods spread across multiple files in the same package, which could potentially lead to the equivalent of a God class in another language, but it's less obvious and more dangerous this way.
Another pain point for me is scaffolding and how to structure complex applications and nest packages. Go pushes you to be as flat as possible with your code structure and package names, however it feels a little clunky.
I honestly enjoy the language and I feel its bare minimum approach together with its extensive standard library really gives back the joy of programming to most collegues, I just find some things annoying.
Thanks for sharing your thoughts on Go! I completely agree with you that Go is simple but not necessarily easy. Its 'forced simplicity' can be both a strength and a challenge. I've also found myself missing some conveniences from other languages, like enums and exception-based error handling.
Handling errors with 'if err != nil' definitely takes some getting used to, especially if you're coming from languages like JavaScript. But I think it's a trade-off for Go's simplicity.
I've been learning Go for about a month now, and I'm enjoying the experience. It's a language that grows on you, and I'm looking forward to continuing my journey with the Go community. Thanks again for sharing your insights! ππ
I believe that you're trying to see Go from the perspective of other programming languages. In Go, the absence of traditional object-oriented programming (OOP) characteristics is a deliberate design choice optimized for concurrency. By treating functions as first-class citizens, Go provides built-in capabilities at the language level to handle concurrency, as everything is kept pure and doesn't manage state.
The approach of checking 'err != nil' is actually better than 'try/catch,' 'rescue,' and similar constructs. This is because developers must explicitly handle the error value, or else the compiler will report an issue.
And my thoughts on 'packages,' they offer a standardized way to organize your code and address the developerβs needs for organization. In my opinion, it's a better approach compared to JavaScript modules.
it is sometimes funny that there is no structured package layout in a language where there is heavy emphasis on standards. The package layout seems to be the most divided and controversial topic for new starters and the most seniors :P scaffolding is a framework behaviour tho, but yea keeping everything flat at the start is very nice then eventually things build up and opinions to structure differ a lot :D
There is a structured package layout, here:
go.dev/doc/modules/layout
As a sysadmin by trade, one of the the things I love most about Go is being able to quickly code up command line utils acorss both Win/Linux systems to do various things such as file processors, file movers and REST servers, I love using Gin-Gonic which makes it ultra easy to dump the native structs direct down the "HTML pipe" as JSON with no faffing about, then pull in html templates and it's so easy to throw up a REST server to do most things. Start messing with Go routines and channels and you get to tap the real power Go offers.
That's one of the things I'm really excited about with Go as well! Being able to quickly create command-line utilities and REST servers on both Windows and Linux is such a game-changer. I'm a fan of Gin-Gonic tooβit simplifies working with JSON and HTML templates immensely.
I'm just starting to dive into Go routines and channels myself, and it's quite powerful, though I'm still figuring out the best practices. If you have any tips or insights on using goroutines effectively, I'd love to hear them. Thanks for sharing your experience! ππ
This list of Disadvantages shows some limitations.
Given that the project started in 2007, the development does not seem to be very fast. In the meantime google started a number of other attempts to establish new programming languages like Dart. Hard to understand why we should use different languages at different domains of web development. This will also limit the usability of the language itself.
I think the article needs an update.
Go has generics since 1.18.
Go hasn't got inheritance but composition is often better.
"Immature standard library" seems a bit exagereted : a common assertion about Go is that it is battery included and there is no need for external libraries, thanks to its standard library.
Thank you for your hint. Can you share a more up-to-date overview about the current capabilities of Golang?
Thank you for sharing your insights! π You've brought up some valid limitations of Go, which is a language designed with simplicity and problem-solving in mind. While it may not align perfectly with the clean code styles of larger, established companies, I believe the beauty of programming languages lies in their adaptability to various contexts and environments. Much like human languages, different programming languages can offer unique perspectives on problem-solving. Diversity in our toolkit can be a valuable asset. ππ
The main limitation of a programming language might not be the concept, but a missing ecosystem.
I had to switch the programming language more than one time in the past, just because there was no other option. You want some server side code on an average web server? You probably will use PHP, but not for the beauty of the code... Put some code on a microcontroller? Start learnig C++...
Your perspective is intriguing. It highlights the importance of exploring various ecosystems. I'll definitely look into it further. π
I don't understand these listed disadvantages:
It's the other way around. The language is called Go, but it's often referred to as Golang, to avoid confusion with the board game with the same name, as well as the verb.
Thanks for pointing that out! You're absolutely right, the official name of the language is Go, but it's often referred to as Golang to avoid any confusion. Your clarification is much appreciated! ππ
Very Nice!
So glad to see you start your journey into the awesome world of Go!
After having really enjoyed writing a number of python-based applications, I was looking to branch out and build my own skills creating bigger and faster programs, which required a more powerful compiled language. I'd written a bit of C++ during college as well as for many of my own IoT projects, but there was something about Go that also drew me to it.
After a couple Udemy courses and documentation binging, I was hooked!
The language is so easy to read (a lot like Python), but packs that static typing and concurrency punch that I was looking for! It now powers most of my cloud backend!
Keep enjoying the journey!!!
Thanks a lot! π I've had a similar experience with Goβeasy to read like Python but with added static typing and concurrency. It's been a great addition to my toolkit. Cheers to our Go journeys! ππ
For me, it was first hard when going from Python to Go with the POO not really existing. But after fully understanding how to use interface to do a pseudo POO that problem was gone. I really enjoy rewriting all by hand and having control all my code after using framework for a long time. I really love using goroutines too.
Here is one of my repo that do a little local domain with https and can manage and map local app port to subdomain dynamically using Gin, Viper and txeh. Feel free to PR if you want to #hacktoberfest.
Thanks for sharing your experience! It's always interesting to hear how different languages bring their own challenges and solutions. I appreciate the insight into your transition from Python to Go. πππ»
Nice! salam wota btw π€
Hi! Salam wota juga bro π€£
The streaming service cli repo is awesome! I starred it.
Question: what was your final verdict as to if golang is easy to learn?
Thanks for the star! π
For me go has become mostly an "integration language" for middleware type projects, or things I used to write in perl, python, and then finally ruby. The simplicity and the large ecosystem seem to fit well for this.
The most latest and most first-rate language model from OpenAI , is a awesome gain inside the realm of synthetic intelligence innovation. This maximum terrific simulated intelligence tool is predicated upon at the GPT-three.5 and GPT-four models, one of the most brilliant and diffused language fashions available