5 ms·
Is Go no longer worth it to learn? Seeing a lot of posts where over the long term go code base is not fun to manage. Was looking at my next language after pyth
by bilal4hmed 5y ago
Is Go no longer worth it to learn? Seeing a lot of posts where over the long term go code base is not fun to manage.
Was looking at my next language after python. Rust is one , should something like kotlin be the other ?
For interviews python seems to be nice and fast to type.
- cle 5y agoI maintain hundreds of thousands of lines of Go code, for a few years now. I would not pick another language for that. The important properties with maintaining code bases like that are language regularity (most code is written the same way and you don’t have to make personal “taste” decisions on things), good documentation and online communities, well-maintained libraries, tooling features for versioning and namespacing, deployment simplicity, etc. Go nails those things. I agree that Python is great for interviews. I would not use it for a large codebase maintained by a bunch of people for years, unless there is a really compelling reason.
- mixmastamyk 5y agoTyping is available now, and other QA tools for years.
- kuang_eleven 5y agoPython has all of those things: - language regularity; black has been the default for years now, and if you want to enforce a different style, there are other tools - documentation and online communities; not even a contest, no language comes close to Python in extensive documentation and online support - libraries; much the same, Python standard libraries are world-class - versioning & namespacing; Depending what you need from this, Python is again more robust, namespacing in Go is a disaster. - deployment simplicity; ...alright, you got this one. Python deployment is harder than it should be. Still, I find my Docker images about the same complexity between the two; more complex deployment in Python, but no need for compilation
- cle 5y agoBy regularity I mean much more than just style. Ironically Go does “one obvious way to do something” much better than Python. When formatting a string, should I use % operator, str.format(), or f-strings? If I want to make a data obj, should I use a regular class, dict, namedtuple, dataclass, or TypedDict? If I’m changing each element in a list do I use a list-comprehension, or loop, or map()? Even unit testing in Go is mostly converged on the stdlib framework, in Python it’s constant back-and-forth between unittest, pytest, and nose. Static typing? Mypy, PyRight, Pyre, Pytype, with varying degrees of IDE support. Speaking of IDE support, which of the 3 major LSP servers should you use? How do I specify dependencies, with raw pip, Conda, pipenv, or poetry? When setting up my dev env should I use virtualenv or venv, or do I not have to use it bc of pipenv or Conda? (I only actually use one of each of those with my own code, but I have to know about them all to work in the ecosystem.) Also IMO, Python’s stdlib comes nowhere close to the quality of Go’s. Somehow despite all this I still enjoy writing Python, and use it sometimes for my personal stuff. But in a team setting on a large code base? Nah.
- ngrilly 5y agoGo namespacing works quite well in my experience. As well as Python. No idea what you mean.
- spamizbad 5y agoA language isn’t going to save you from a bad codebase. And the longer I work in this industry the more this has become apparent to me.
- baby 5y agoIt's funny but I'd still say that Golang is the easiest language to maintain, due to the code being harder to write but easier to read.
- Philip-J-Fry 5y agoGo is 100% worth it. If you're seeing these posts on HN then you should know that the majority of Go posts here are just "why Go is bad" posts. You'll rarely find an upvoted post about why Go is good. From a Go dev who came from .NET, Go is one the best tools I've learned in a very long time. Code is incredibly readable, I never come back to an old code base and have to wrap my head around the weird abstractions like "MapperServiceFactoryFactory" because they're no idiomatic. Code can be verbose, but the verbosity is what aids its readability. I haven't had any issues maintaining large Go codebases, the only issues you come across are the same regardless of the language you use. And that's things like ensuring consistent style across a team of developers.
- dcow 5y agoI thought large Go codebases relied almost religiously on `gofmt`.
- Intermernet 5y agoThere's obviously more to style than code formatting, but yeah, every Go codebase should rely on gofmt. I'd go so far to say that every language should have an equivalent to gofmt. There are so many advantages, the least of which is eliminating meaningless diffs in git where (for example) one person used spaces and put a new line before the opening brace of a function, while the other person used tabs and put the opening brace on the same line as the function definition. That drives me crazy in other languages!
- Matrixik 5y agoOr even better `gofumpt` that is more strict.
- dangoor 5y agoI hope you didn't get an impression like this ("Go not being worth it to learn") from my post. We think it's great and that our Go is going to be much easier to maintain over the long term than our Python was. It's all rock solid and easily understandable by the whole team.
- bilal4hmed 5y agoThank you for the reply. I didnt get that impression from your post at all, but from the larger comments & posts on HN and programming subreddit. I have wanting to learn Go, but seeing so much negativity around it was making it harder to start learning.
- dangoor 5y agoGo may be more polarizing than a lot of languages. It makes tradeoffs that aren't as exciting, which turns people against it, I think. There are plenty of legitimate reasons to choose a different language, so it makes sense to figure out what's important for oneself and go from there. The only problem is that it's hard to know all of the aspects that may be important without trying a tool out... so we do, quite reasonably, turn to blog posts with other people's opinions. I do think it's good to differentiate the opinions of people who have really worked with the tool vs. those who are just e.g. complaining about Go's error handling because they're used to exceptions but they haven't done any significant work with Go. For deciding on whether or not to learn a language: I'd say it depends on _why_ you want to learn a language. If it's for getting a different job, then look at the kinds of jobs you want and learn the languages/skills to do that. If it's for pure knowledge, then learning languages that teach you something new are useful. Go's concurrency might be interesting in that regard. Rust's borrow checker is certainly interesting.
- iudqnolq 5y agoWhat do you want to do? Rust would be a great pick for "systems" code, or anything where you need to talk to existing c/c++ code. Pretty good for CLIs if you're the sort of person who enjoys puzzles. Definitely go for kotlin if you want to write a GUI. I'd also recommend Kotlin (or maybe go, never used it) if you want to write a server. Rust has ambitious but not there yet server frameworks, and it's quite hard to go off the beaten track with most Rust server frameworks (say if you want to write your own little cache layer). I'm just a student, but I have the impression rust isn't a good choice for maximizing career prospects. Still writing it, because I love it.
- kyawzazaw 5y agoHow do you write so much as a student?
- iudqnolq 5y agoProcrastinating :) It's an average of around 15 loc/day, and I'm not great at going to sleep on time.
- mplanchard 5y agoAs someone who just took a job writing rust recently, I have to disagree with your take on the career prospects. I specifically looked to switch to Rust in my last job search, and I had plenty of companies to apply to. The market also is only getting bigger, with all of the FAANG(M) companies now employing a significant number of rust engineers.
- iudqnolq 5y agoThat's really exciting to hear. I'm struggling with a cs degree (especially the mathier bits) at a mediocre school, and I think the sort of jobs looking for Rust are looking for a more traditional background. Still, I hope I'll get a job in Rust someday.
- mplanchard 5y ago
- alert0 5y agoGo is my favorite language but I'm still learning Rust. Would highly recommend either. I hate Python as a language but use it for web scraping and the occasional data transformation.
- nine_k 5y agoIt is of course worth learning, very much like Java, PHP, C, or Cobol. These languages are going to be with us for a long time, just because of the large amount of important code written in them. If you want fun, you might consider other languages, like Ruby, or Clojure, or Rust, or Scala, or Elixir, or... But they are not going to be as much the foundation of corporate software, exactly because they are more expressive and require higher qualification to handle well. The languages from the first list, though, while more boring, provide a more certain piece of bread and butter.
- oconnor663 5y agoI'll say this as a huge Rust fan: If you're thinking about learning Go, just go ahead and learn Go. One of Go's strengths is that it's very quick to pick up, especially if you already know at least one statically typed language. You can get a good sense of it in a weekend, and then you can make an informed decision about whether you'd like to keep working with it or try something new. By comparison, even experienced programers take at least a few weeks to start feeling comfortable and productive in Rust.
- dcow 5y agoMake sure to write tests in Go before you decide. I liked Go a lot more in the honeymoon period after just learning the language before getting into the weeds of the amount of code required to ensure correctness. While rust takes longer to pickup, I strongly believe it pays dividends down the road.
- wejick 5y agoI see there are a lot of go shop companies, basically most of "start-up ey" tech company use go in someway or another. So I don't see why go is not worth to learn. However depend on what engineer are you, IMHO go is one of the top mindshare language for backend services.
- otter-in-a-suit 5y agoDon't think the HN bubble is real life. go, much to my surprise, has been pretty well accepted by companies that used to do Java and Python exclusively (at least in my experience w/ projects). It's still insanely frustrating in many ways, but if you need code that is fast (i.e. faster than Python), typed (I don't think type hints are a valid replacement), where concurrency is not a never ending nightmare (or at least not any more than it needs to be), and compiles to native binaries, go is a great language to use that doesn't scare large companies away.