loading...

Discussion on: Transisioning from Python to Golang and why Python programmers should consider it.

Collapse
lietux profile image
Janne "Lietu" Enberg

Go is a great language, but unfortunately in its current state right now it's a bit of a minefield - hard to find the right way of doing things, easy to find the wrong way.

E.g. github.com/avelino/awesome-go lists all kinds of great libraries to use with Go, but then gives no practical information on them - which libraries are abandoned, low quality, were never finished, etc., what people RECOMMEND and so on.

The module vendoring system is pretty nice, when it works properly, but using it correctly is kinda hard and there are annoying bugs.

The system for resolving and fetching dependencies automatically is nice, but Git is the wrong way of handling it, and there are some issues caused by it - they really need a real package repository instead.

There are lots of great tools for logging, validation, writing CLI utilities, and unit testing, but they're all hidden in the middle of this mess of everyone being afraid of giving clear indication of what people should be using.

The gofumpt, gofumports, golangci-lint and many other great automated tools to ensure your code is of high quality exist, but it can take a while to find them - they should be just integrated to the base library and run on compile to stop you from running flawed code.

I love Go, have used it actively for several years, and I would recommend it for everyone to try out - just understand that figuring out the differences between it and how you're used to doing things in other languages takes some time.

I would not compare it to C/C++ too much though, since it is a wildly different experience for a developer. Builds are fast, writing problem-free code is easy, and the language is dynamic in the right ways.

The only consistent annoyance for me is that there are no real "classes" and thus no real "inheritance" - you can do something like that, but it has limits. There are a few other cases where you end up writing what feels like boilerplate in other languages, e.g. map and list manipulation and checking functions, but you get over that being an issue pretty quickly.

Collapse
chand1012 profile image
Chandler Lofland Author

I agree for the most part, and C/C++ probably wasn't the best of comparisons, its just one that I am quite familiar with. gopls is my language server of choice for debugging and the like, and it now comes with Go when you install it. I chose it because VSCode's Go Extension supports it with no configuration. And I wouldn't say there is no way to do class-based (Object-Oriented) programming, but you have to think about it in a different way. Take the library that I used for my discord bot, discordgo. While Go doesn't have dedicated object or classes it does a good job at doing object oriented programming in Golang.