DEV Community

What to choose Golang or Rust?

Noishorgo Broto on October 06, 2023

Hello Everyone, I want to learn a new programming language for upskilling. So, what language should I choose Rust or Golang? I am a little bit confused. Which will be better Rust or Golang?

Collapse
 
taikedz profile image
Tai Kedzierski

Without any further context, this question is unanswerable.

  • What industry are you aiming at?
  • What tech area (web, back-end, front-end, embedded, AI, IT, statistical analysis)?
  • Or is this just for hobby? What hobby? robotics? AI? server deployment?

❌ In many cases, Rust and Go are both poor choices to focus on if you want to enter some specific industry .

Each language has its place in some ecosystems more than others.

πŸ“ˆ E.g. if you're aiming to do statistical analysis in a science/research department, your colleagues will want you to have R and/or Python and likely reject any suggestions of Go or Rust.

🌐 Equally, if you want to work on front-end dev, focusing on JavaScript/TypeScript will be more fruitful.

πŸ› οΈ If you're looking for integrating with existing tooling, look at what those tools favour most. If it is neither Go nor Rust, then the observation answers itself.

πŸ€“ If it's for the sake of learning/having fun, or for future proofing, learn either or both . πŸ˜„

Note that these days the question of πŸ¦€ Rust vs ⚑ Zig is more frequently popping up than Rust vs 🦫 Go - and for good reason. But what's your reason ? βœ…

Collapse
 
danielumorales profile image
Daniel Ulises

OMG Python because is blazing fast

Isn't?Both bad choices? Maybe if you want to refactor or interact with C++ you would be crazy to choose Go/Rust instead of Carbon

Collapse
 
bro_dev profile image
Noishorgo Broto

Hello, Thanks. I am actually interested in learning backend development.

Collapse
 
jimmymcbride profile image
Jimmy McBride

Go for backend development for sure. Go's concurrency is killer and the whole language was built for backend and microservices

Collapse
 
livioribeiro profile image
Livio Ribeiro

Go is certainly easier to write, and is a good choice if you like the old C style of doing things, but has some pitfalls that you must be aware of.

Rust has a more strict syntax, is more verbose, but imho it has less pitfalls and can give you a better understanding of the flow of data throughout the code.

Both languages are good, if you want to write backend servers Go will get you there quickly with just the standard library, but with Rust you will need a library like Axum or Actix and a bit of understanding of async.

Collapse
 
adaptive-shield-matrix profile image
Adaptive Shield Matrix

do you plan doing much async stuff?

  • If yes -> choose go
  • If no -> choose rust

Here an article that goes into detail why async rust sucks
bitbashing.io/async-rust.html

example, you are writing x:

  • embedded code -> rust
  • internet of things -> rust
  • system programming -> rust
  • web server without calling other async endpints -> rust
  • web server calling many other async endpoints -> go

please further note

  • rust -> ist about 2x times faster to execute/run code (no gc)
  • go -> is about 2x times faster to write code (general web server)

Its about your personal values, what do you value more?

  • Writing the fastest possible and most efficient software (and bragging about it proudly on the internet)
  • or getting to a solution as fast as possible (and having more free time or getting more things done)
Collapse
 
alice58 profile image
Alice 🌈

Go and Rust are similar in the way that Python and JavaScript are similar. Try out the both languages, and see for yourself.

I suppose that you are a novice developer, so I assume that Go would fit better since it has been made to be easy as python, but as powerful as C++ (iirc)

Collapse
 
shaikabdulthouhid profile image
Shaik Abdul Thouhid • Edited

Go and Rust are similar in the way that Python and JavaScript are similar

But the chasm between Rust and Go is very broad (I mean ideologies or design or use cases or quantity of features) compared to Js and Python.

Collapse
 
pengeszikra profile image
Peter Vivo • Edited

Try go and rust on codewars and you find it which one is fit for you. My vote is : rust.

Collapse
 
shaikabdulthouhid profile image
Shaik Abdul Thouhid

I would definitely recommend GO to anyone who want to learn a new language, and their main area of focus is not web page development (you have no choice, go for Javascript). Go should suffice for most of the use cases... Use Rust if performance or security is the most important criteria for your personal or enterprise projects. And Rust's steep (I mean really steep) learning curve makes it not for everyone... Though I personally love Rust more compared to GO, but I tend to use GO more compared to Rust... How irony... πŸ˜…πŸ˜…πŸ˜…

Collapse
 
tailcall profile image
Maria Zaitseva

Choosing Golang would be a very practical choice.

Collapse
 
artxe2 profile image
Yeom suyun

In general, projects where Go's GC is a major obstacle tend to choose Rust.
I recommend Rust because some of its concepts are quite interesting.

Collapse
 
jaredpatrick profile image
Jared Patrick • Edited

Go for concurrency or if you plan on working with cloud native technologies since many CNCF and other cloud tools are written in Go (ie. kubernetes, prometheus, argocd, docker, dagger).