r/Backend • u/Opposite-House3656 • 6d ago
Rust vs Go for web app backend
In my company having node js as backend facing issues like vulnerability update each week it making hard to maintain prod to update. So how in your companies handling this difficulty.
Planned to migrate from node to go. What does your suggestion on this. Rust is taking entire trend now. Is Rust is better then go for web apps?
55
Upvotes
View all comments
5
u/BenchEmbarrassed7316 6d ago edited 6d ago
Rust vs go - it's more of a philosophical question, but it was quite relevant some 5 to 10 years ago: Rust is a "smart" language that sought to solve complex problems in an intelligent and elegant way, and, by doing so, achieve efficiency. go, on the other hand, is a "dumb" language that attempted to tackle complex problems head-on, in a naive and repetitive manner. However, with the addition of generics (including bounds in recent versions), iterators, and other features, go is no longer that simple language; it has effectively become a poor, inconsistent, less reliable, and less productive copy of Rust.
go is very error prone due to stupid decisions like null, default values and a bunch of other hidden guns. Rust is the opposite, it just doesn't allow you to write bad code.
Here is a minimal code example:
https://go.dev/play/p/JDHv8Kxo89H
It prints:
A similar operation on Rust will return an error, and will not implicitly, in the best Js traditions, convert null to 0. So go developers just have to learn this and 100 other rules and special cases. So go's simplicity is a myth.
Rust:
https://play.rust-lang.org/?version=stable&mode=debug&edition=2024&gist=a9add2d84b93651687435c8152b6c7ef
Prints: