DEV Community

Discussion on: Go vs Rust for web dev

Collapse
 
cdmistman profile image
Colton Donnelly

Late to the party, but came across this post just now.

The Go vs Rust debate is a long one. Both langs came out around the same time (Go was the first to reach stability, though). They both try to achieve 2 different things, but achieve them so differently that there's been a lot of debate.

As someone with experience with both, I personally find Rust better (I came across this post while looking for posts for This Week in Rust, haha).

Rust: Probably the safest language you can use. You'll find the majority of your bugs will be related to logic errors (as long as you abstain from unsafe usage). The ecosystem is full, and encourages use of others' libraries. If you aren't familiar with Rust, you'll find some difficulty in learning the language. However, I find Rust to be better-suited for flexible programming, allowing you to write more types of programs, safely. Another perk is the lack of a garbage collector, which tends to affect high-scale programs negatively.

Go: Probably one of the easiest languages to learn. Learning is quick, writing is quick, and compiling is quick. However, the biggest issue is that (in my experience), Go is really only a great language when you're doing networking programming (server-side).

Note that I said "great" in that last sentence: while Go's strongest suit is network programming, it shines best when you're prototyping the server app. Many companies including Discord have released blog posts saying that they implemented some of their backend using Go, but moved to Rust later on, since Go's garbage collector was causing latency issues or for some other reason.

For wasm, both are fine languages. While I don't have experience either for wasm, This Week in Rust usually has at least one article every week on a tutorial for using wasm with Rust, so I know there's plenty of resources for learning that.

Ultimately, it's up to you to choose which you want to use. I'll leave you with a piece of advice I came across recently: if you want to learn quickly, use Go. If you want to learn properly, use Rust.

Disclaimer: While I do have a bias for Rust in nearly everything, I do still use Go for some things. I'm currently working on an ssh server in Go, which I chose for two reasons: writing quickly, and the two main libraries I'd like to do (Docker provides an SDK for Go, and I found a nice SSH server library in Go that I liked)

Collapse
 
glebirovich profile image
Gleb Irovich

Hey Colton, thanks for the detailed explanation. In the end I decided to go with Rust. I was attracted by the fact that it imposes some challenges and has some concepts, which are new to me. I like pushing myself out of the comfort zone.
As you seem very experienced with Rust, could you suggest some learning resources? I completed a couple of Udemy tuts, but I would prefer doing something more hands on, where I could develop something meaningful along the way.

Collapse
 
cdmistman profile image
Colton Donnelly

Check out the Rustlings course! It's the RustBridge course managed by the Community Team, it's a great way to get practice with reading and writing Rust
github.com/rust-lang/rustlings