9 ms·
What's the role of Go in a universe where Rust exists?
- hn_asker 6y agoGo is much easier to learn and get up and running compared to Rust in my experience. It's great for writing servers and multi-threaded applications. Rust can be used to optimize but you'll probably get a lot of mileage out of golang before having to switch.
- DLA 6y agoAll the things 'hn_asker' said plus a giant ecosystem, huge developer attention, amazing tooling, outstanding support for parallelism, jobs, a good pool of enterprise-grade projects (CockroachDB, all the thinks from HashiCorp, K8S, Docker, etc). And Gophers!
- dnautics 6y agoDid you read the article?
- DLA 6y agoYes, yes I did and stand by my comments. Go has done everything my team has asked of it and done it well. It’s a joy and rock solid. I have code deployed all over the world and Go made that manageable in so many ways. Language is personal choice. Choose what works for your set of engineering and devops challenges.
- dnautics 6y agoThat's not far from what the article says. Your comment sounds like you were being defensive of go from the article.
- kevincox 6y agoI still don't think Go is a good language. I had notable experience at Google and the following things constantly bugged me: - It was very difficult to read. When trying to review the code every detail was left out. While each line was simple it was hard to actually get the high-level picture of what code was doing. - Very error prone. Maybe it isn't C dangerous but "defaults are useful" is the breeding ground of bugs. The number of outages we had due to trivial Go bugs was embarrassing and time consuming. - Some simple things are just too hard. Most of these boil down to lack of generics. For example inserting an element into an array needs multiple lines of code. - Many common functions and buitins have very questionable decisions that are huge footguns. Especially the fmt library. (It tries its absolute hardest not to fail. Instead it just outputs garbage and "succeeds") I get that it is easy to write, and that each line of code is simple. However I think they went way too far. I see Go as a slightly higher level C. You get better package management, memory management and interfaces. However C is still way too basic for my preferences. It is a weird spot though. It is sitting in about 2x C performance. It is unclear what to recommend in that spot as many languages are significantly slower. Rust is probably roughly as productive, but much harder to learn. Most of the interpreted languages are significantly slower. There are some JVM languages that are better and have similar performance. However there is a memory and startup overhead. However I think they make more sense in the end. JavaScript is also a pretty good choice. It is in roughly the same performance realm but much more productive I think. (Especially TypeScript).
- skyde 6y agoAre you saying that python is better than GO on syntax alone? Like easier to review code ...?
- kevincox 6y agoIn many ways yes. The high level code it is far easier to review the semantics of the change. With Go I feel like I am too bogged down in all of the unimportant implementation details. (I don't really care how you implemented `map` I don't need to see the 4 lines of that loop) Of course with minimal static typing it is easy to miss more "typo" style bugs but those tend to be caught fairly easy in tests and are obvious when they fail.
- wahern 6y ago> With Go I feel like I am too bogged down in all of the unimportant implementation details. But then when people praise Python and Rust, getting bogged down with "unimportant implementation details" like specialized async typing and colored functions becomes an absolutely essential and useful aspect of the language. There's just no accounting for taste...
- kevincox 6y agoI agree that async creating coloured functions is a compromise. However in practice I don't find it too distracting. At the very least it is less distracting then Go's error handling. (Although IIRC that is going away thankfully) However if you put N:M threading against 1:1 threading then you can argue about that all day. I think the implementations in Rust and Go are very effectively implementations of each model. The threading model difference is *not* something that I hold against Go. It is possible for a language to handle some things well but have other downsides that makes me prefer to avoid it.
- mpfundstein 6y agoin all seriousness, but how many golang and python code bases of roughly equally the size have you reviewed and examined? Python is HELL if you are new to a codebase. Everyone has their own conventions, lack of typing means you need to do a lot of guesswork, dynamic calls break up control flow etc. Yes, go is more explicit (lack of generics...), but at least its straightforward. Just compare k8s codebase with nomad with your homegrown stuff. It will likely look a bit like the same sauce...
- dnautics 6y agoGreat article. I would say my two minor disagreements is that go's fast compilation is not... Typically used for tests, in my opinion the testing discipline in go is low. I would go so far to say that go is neither "a better c++" nor "a better c" but rather "a better python".
- zinclozenge 6y agoThe golang stdlib is a little too barebones to be a better python, as well as not ergonomic enough. Faster, yes.
- dnautics 6y agoSorry, I should have specified: a better python for google. Google doesn't generally need all the things in the python stdlib. It does need a way for their legion of new hires to not trip over themselves and slot into an enterprise-friendly programming mode
- maxekman 6y agoGo is good because it’s easy to read and pickup, and it compiles really fast. I would say it’s good for request based services but I don’t think it’s as good as it can be for enterprise code. What I miss most is the lack of sum types to limit state space, which is very useful in business logic.
- igmor 6y agoThat's a wrong question to ask. Rust is the one trying to squeeze in to the already crowded place, not Go.
- elipsey 6y agoThat fact that we need to prepare in advance to defend learning a new-ish language and then using to build something interesting or useful is a depressing. Oh well, the PM will make you re-write it in that k8s thingy anyway, because everyone else has it.
- waych 6y ago"The Go compiler is fast." This was Google's motivation for Go and the reason it was designed the way it was.
- obviouslynotme 6y agoMost people don't understand what it's like to work on a large C++ or Rust code base. Compilation time is a huge factor in productivity.
- hbt 6y agoincremental compilation is so slow in rust. it is ridiculous. it completely ruins my flow
- MikeDelta 6y agoThe other day I read an article about which language C programmers should use, and how Go is better thought of than Rust but that in the end his suggestion is to go for C++ [0]. Interesting observation was that the Rust community had more fanatic followers who believe in Rust and nothing else, whereas the Go community was more relaxed about it. That makes me wonder: if something had been written in Rust, would a Go, Python, or C++ developer ask why not in their language? Or would they just not care? [0] https://berthub.eu/articles/posts/cpp-rust-go/ https://berthub.eu/articles/posts/cpp-rust-go/
- nesarkvechnep 6y agoJava developers would surely ask "Why not Java?".
- pornel 6y agoTo me Go is competing with JavaScript, not Rust. If you're considering writing a CRUD app in Node.js, you can do it in Go, and it'll be equally easy, and maybe run faster. But if you're writing a driver, codec, kernel, firmware, or even a library that's supposed to be usable with more than one language, Go is just not a good fit.
- deleted 6y ago[deleted]
- mpfundstein 6y agosorry. but if you really choose to write a simple CRUD app in go, I feel very sorry for you. Go is terrible for this kind of stuff. On the other hand, if you are about to write a nice daemon that needs to do some difficult stuff and C is a bit too low level for you (or a deadline is pressing), then go might be just be the perfect tool for it. I use a lot of languages, and golang usually only ever competes with C or C++. For the scripting/CRUD-like stuff i Usually still prefer NodeJS or python.
- hactually 6y agoPity because you don't understand a language is a weird one.
- lgunsch 6y ago"Go is simple" is the main one and only reason I love Go. I learned Rust in my spare time, and it took me months to get to the point where I could write anything useful at all. I never did feel like I knew the language. I just don't have the spare time and energy to put in such a monumental effort into learning a language. After 2 weeks of Go I knew nearly all the ins and outs of the language. Once you add in sophisticated and strict linting from golangci-lint you just can't go wrong. Code reviews are a breeze and understanding code is a breeze.
- alisonatwork 6y agoFully agree. For me Go is the ultimate "scratch the itch" language. Knowing C already, I learned everything I needed to know about Go in an hour or two. I see it as a faster and better version of Python, in that it's fairly readable, but unlike Python you can compile to native binaries and deploy on any platform (including Windows) without any fuss. Personally I don't see it as competing in the same space as Rust. I've dipped my toe into Rust a few times and the language feels like way more effort than it's worth for the sort of glorified shell scripts I want to do in my personal time.
- knodi 6y agoDevOp, Python replacement.
- todd8 6y agoI'm not looking for a job, but I'm often invited to chat with a company's dev team, and I get a chance to see what they are doing and how they are doing it. The last company I visited was a handful of Physics Ph.D.s. They were writing control software. Obviously, this team was really smart, but they were not high power software developers. They weren't ex-kernel developers and they didn't write 3D game engines in their spare time. They were just really smart guys that knew how to program. They were using go, and I felt like that was a great choice for them. Fast enough performance, comfortable development, and easy enough to understand. This is what I really like about go. Languages like Haskell and Common Lisp are popular topics here on HN, but they'd be poor choices for a startup made up of domain experts that aren't CS-majors. I'm sure these guys could have learned Rust or even modern C++, but with go they could get started in a language that wouldn't take a year of experience to use correctly. For my many little personal projects, I like python, but for team projects were there will be a mix of abilities go seems like a good choice.
- knodi 6y agoThis is all the same reason I and the company I work for use Go. It’s good tool and powerful in hands of smart people.
- nesarkvechnep 6y agoI'm not sure one has to be CS major in order to understand Common Lisp. The language has almost no syntax and is multi-paradigm. I bet modern C++ and Rust would be much harder for them compared to CL.
- dzonga 6y agoGolang though excellent lost the plot by having Nil pointers. it means bugs will always exists inside code intentionally or not.
- naikrovek 6y agoWell, if you have an unexplained hatred for typing double colons five times per line of code, as I do, Go allows you to not do that. Rust::Forces::Them<Colons>::Everywhere::AllTheTime();
- metreo 6y agoHonestly it's certainly not the worst language construct?
- naikrovek 6y agoIt's not the worst, but for me, it is easily the most hated. It's a stupid thing to get hung up on, I know. For some reason my hands don't like to type colons, even though semicolons and shift keys alone are just fine. I just hate typing colons. Feels lazy to adopt a C++ construct when you are trying to produce something to replace C++, anyway. There was an opportunity to choose something less C++-like but someone thought "I'm used to doing this because of C++, so I'll keep the double colon" and kept it around. Ok, that's fine, and I'm gonna keep talking trash about Rust, because I'm used to doing it because of C++.
- vinliao 6y ago> Let’s avoid tying our identity to a single language and embrace practicality first and foremost. This is very poignant. I feel like there a part of us that is attached to a certain language/framework, and we intentionally wear a blindfold to avoid seeing other solutions that are more practical.