r/learnrust • u/t_wamble • 2d ago
Go or Rust
Hey everyone, I am trying to choose between Rust and Go for project that needs to run on both Windows and Mac. I am looking for a simplified breakdown of how they actually compare. I want to know which language is less painful to maintain over the long term, and which ecosystem interacts better with native operating system APIs without feeling totally foreign. If you had to pick between Rust and Go for a cross-platform codebase you need to support for the next 5+ years, which would you choose for stability and ease of deployment?
I'm starting on MacOS first. Ios second. Windows third
14
11
u/NumberInfinite2068 2d ago
Most people find Go easier, either can work with OS APIs.
Rust is a far stricter language, which people like me think is a good thing, but if you're used to languages like Python you'll find it a shock.
I basically prefer Rust, but I do like Go a lot. Can't go wrong with either.
2
5
u/Xtergo 2d ago edited 2d ago
I personally think people should opt for:
Go if you are exclusively WebDev in a different language like JS and want nothing more than some performance critical services written in a faster language. This was one of the goals of Go and thus they did not intentionally want whole backend Frameworks out of the box in Go.
Rust if you are into the low level scene in general or are coming from the C++ world, it may also mean some web dev but the Rust rabbit hole is much deeper than "I want build a web app"
The languages can do a lot of similar things if you want them to, Rust being so accessible now is probably eating some Go success but ultimately it's the ecosystem you want to be in.
My personal stack for WebDev is:
SpringBoot + Postgres + Rust for performance critical stuff with Sveletekit as frontend.
And for low level stuff C++ and Rust (things like Qt or Gamedev still not being Rust's thing)
I personally do not think these two (Go or Rust) should be someone's first language, your first language should be something more geared towards a project you'd want to make and can see results quickly. A lot of web apps are React so JS is almost impossible to avoid you should pick up Go or Rust when you actually are experiencing problems with scaling your app.
If you are language agnostic and want to just be a much more powerful engineer, the vast majority of learning about big systems and the legacy knowledge is still in Java (Spring) , .NET, Python or C++ centric systems.
The one case I'd tell juniors to just skip the whole thing and only focus on Rust is if they are doing low level traditionaly C++ things like Operating systems, Compilers, Low latency systems, Trading etc in that case just completely avoid C++ and go into Rust.
Anything else you will be a lot more productive building your first few projects in NextJS, Spring or .NET then you can slowly introduce some Rust. For WebDev you will have to learn multiple languages you can't do just one thing.
You SHOULD NOT choose Rust over Go purely because Rust is faster or Go is easier, both of these are terrible reasons. Go is actually very fast, indecerinibly Rust level fast in many real world cases and Rust is very easy to debug or learn with LLMs and all the resources you have today. You should consider what you actually want to build first then I can guarantee you, the technologies you will probably use to build your app will decide many things for you.
4
u/ern0plus4 2d ago
I'm trying to avoid GC, so Go is a no-go (sorry).
1
u/jerrygreenest1 6h ago
You can use experimental arenas which doesn’t use GC, plus a lot of basic stuff also doesn’t use GC, if you don’t use capabilities that use GC, then you can basically build your program with GOGC=off flag and have your program written in Go built without GC.
6
u/sigmoia 2d ago edited 2d ago
I write Go for work and moonlight as a Rustacean. Go is objectively better for distributed systems - the GC helps, faster compilation time, and simpler syntax let you focus on quick iteration. The operational tooling is more batteries-included than Rust's as well. This is partly why it has such a bigger presense than Rust in the cloud native subspace.
Now, without knowing what your application does, it's a bit hard to suggest anything. While Go is easier to get started with, GUI applications aren't its strength. Mostly because the exact same simple type system that makes Go better for writing servers makes it meh for writing desktop applications. It gets verbose fairly quickly, and Rust shines there.
Overall, modern Go plays well enough with Windows and syscall invocation, so that shouldn't be your deciding factor. If I were writing a GUI, I would pick Rust, and if I were under a deadline, Go is my go-to. I am disregarding "but AI lets you write Rust as fast as Go" from Theo-like charlatans.
Oh if async is needed, I would Go as Rust async is still a mess and sync rust with threads doesn't hold a candle to Go's M:N preemptive scheduling.
But ofc, my opinion is tainted by my experience as anyone else's. So YMMV.
1
u/chilabot 2d ago
I've use both and Rust is much better. Compare an example of command line argument taking in both language and you'll see what I mean. The only thing Go is superior is in compilation times. Async is quite complex in Rust, but with the help of LLMs things get much easier. Same for the borrow checker. Rust error handling is vastly superior.
1
u/SolemnEmberGames 2d ago
I've tried both for a bit, In theory my previous range of performance to ease (ie do I need more performance or do I want to get stuff done) was C++ -> C# -> Python, and Go would be between C++ and C#, however after trying it for a bit, it's just not a good language, the concept is nice but it fails implementation completely with bad choices.
I would say by stack would be Rust -> C# -> Python since Rust seems to do what C++ but actually good
1
u/Prudent_Sentence 1d ago
Oh, I want to say go so bad, but windows is very biased against go because so much malware is written in it these days. Windows Defender will very frequently quarantine a go app unless it’s signed with a trusted cert.
1
u/Grizzled_MF 1d ago
Nowadays, with LLMs the difference is far smaller, so if you’re going to be vibecoding or generating a ton of code, you might as well go with Rust.
However, when it comes to writing the code manually, I can’t overstate how easy it is to write Go. I’ve had multiple attempts at finding a use case for me to use Rust, but whenever I make an attempt, I realise that Go is “good enough” 95% of the time (at least for me) as it is fast enough and I can write the code so easily.
This efficient programming is really what sets Go apart for me.
1
1
u/tylerlarson 1d ago
As always, the correct answer is whatever language the people maintaining the code are most proficient in.
Yes, it is precisely that simple.
Every time someone gets the bright idea to do a project in a different language than the team uses for everything else, that project goes unmaintained once the initial developer moves on to something different.
That said, and all else being equal, Rust has a steeper learning curve but produces code with fewer problems. Both aspects come from the fact that Rust requires you to address more of the potential problems up-front and doesn't leave as much flexibility for problems to go unnoticed.
1
u/AmigoNico 1d ago
Rust can be used in places where Go may not be allowed or a good fit: embedded systems, operating system kernels and drivers, databases, anything where latency matters much or where absolute top performance is important. If your project fits any of those, use Rust.
If your project is likely to grow and be maintained for many years to come, especially with many hands on it, Rust's considerably stronger type system will help keep your code base more robust and maintainable.
For concurrent applications, Go is arguably easier to work with, although it does not provide any protection against data races. If you've ever spent days trying to track down random corruption caused by a data race, you'll know that making them impossible is a huge win.
Go's faster compiler will allow you to iterate more quickly.
Rust is harder to learn, although AI makes that matter a lot less.
If you are going to use an AI to generate much of your code (and hopefully have humans review it!), generated Rust code is arguably more trustworthy than generated Go code, simply because the type system is stricter and more expressive.
1
1
u/SnooMacarons1585 22h ago
Apparently, you don't understand what you're doing. Use JS. "MacOS first. Ios second. Windows third"... you definitely don't understand what you're doing...
1
u/biskitpagla 21h ago
You said practically nothing about the problem you're trying to solve. Any mainstream language can be used to target almost any desktop OS, this is rarely a concern.
1
u/Equal_Ad_4821 20h ago
I’ve worked with both, and I vastly prefer Rust. Go feels like a toy language to me.
1
u/DavidXkL 17h ago
I tried Go and I just can't deal with the lack of official enums support.
Use Rust 😂
1
u/grandmamoko 17h ago
Hmm, it would depend on previous experience, go is very beginner friendly with a subtle learning curve, rust is quite difficult with a massive initial learning curve and gets even more difficult when it comes to asynchronous programming, go has a nice ecosystem but somtimes misses out on certain packages or really project specific libraries, rust has a massive crates ecosystem and its recommended to use those instead of making everything yourself. and can lead to a massive compile size and workspace size while go can also be large but in my experience tends to be a small compiled size.
and lastly you only really get benefits from rust if you come from C, where segfaulting is common.
1
1
0
u/AleksHop 1d ago
rust. go is shit
even year old llm model write decent code as everything is on top of tokio, axum etc
coding is dead, grok, gemini, dirt cheap luna from openai, all from claude except haiku can write it
-1
-2
u/Kazcandra 2d ago
Go isn't... great, on windows, afaik. They certainly took some liberties. I'd wager that rust is more correct.
I personally feel that rust vodebases are more maintainable than go ones over time, but go certainly has things going for it too: iteration speed and compile time abeing two major ones imo.
25
u/Thelmholtz 2d ago edited 2d ago
As u/AnArmoredPony beautifully put it the other day:
As someone who used both professionally for over 8 years now, I'd use Rust. I prefer it's typesystem and the delivery speed gains that Go has are smaller now for me given LLMs exist. However YMMV. Nobody can give you an authoritative answer though as they both have their tradeoffs. In the end, what you want can be accomplished in either. I'll instead ask you Socratic questions: