Skip to content

Comment on Go vs. Rust: Writing a CLI Tool

Comments

I love Rust, but a few drawbacks made me choose Golang over it:

- Compilation Time - IDE experience: I have yet to find a good IDE that works like Goland does for Golang, this anyways is due to the compile time :( - Non-static binaries by default - Too verbose (compared to Go) - CLIs are not that easy to write compared to Golang, but this might be due to the fact that I have yet to find a similar library to alexflint's go-args for Rust - Lifetimes: I'm too stupid to understand them properly, and I get frustrated when I think I understood them and then I spend half of my development time to fix an ownership issue

Again, I _love_ Rust language, but I very much hate its compiler, and thus my general development experience. If RLS and the Rust compiler were as fast as Go's one, I guess that the whole experience would be much better for me. Additionally there isn't really an IDE for Rust that works like Goland for Go :(

I have to admit that I'm much faster at writing Go CLIs (and I wrote a lot of CLIs in the past couple of months), but I might be biased for the reasons explained above that didn't let me enjoy that much programming in Rust.

For a private project of my own, composed of three libraries, I spent most of my time fighting with the borrowing system and the verbosity of the language itself (like `pub field` rather than Go's `Field`) or the whole `json:"fieldName"` annotations that Golang uses.

Last, but not least, I can cross compile Go projects from my Linux computer targeting Windows without any cross compiler toolchain, and the resulting binaries are static. This is a feature I love!

I would very much like to have somebody providing me with tips on how to improve my Rust experience

Have you tried IntelliJ-Rust? I am curious how it differs from Goland (I've never used it.) I personally use VS: Code with rust-analyzer, which is the successor of the RLS, and much better.

structopt will give you a go-arg-like experience. clap 3 is going to adopt it, in my understanding, so that reduces the number of packages.

IntelliJ Rust is good, but has still the same problem as any other IDE for Rust (that is, RLS performance). You have to wait 5-10 seconds to get a feedback from the compiler :(

The combination that works better is Clion + Rust plugin, but just because you can easily debug w/ gdb.

I still have to try Rust-Analyzer, first time hearing it - hooefully this will improve my developer experience: heck RLS is slow as hell even with vim :(

Thanks for the tips Steve!

Ah, IntelliJ-Rust doesn’t use the RLS, as far as I know, so I wasn’t sure how its performance compared.

rust-analyzer is way way faster.

Thank you for elaborating!

Thank you for your tips! I'll try again to dive into the Rust ecosystem, hopefully with a more happy outcome thanks to your tips :)

AboutSource Built by g1lg1l

Hackerly is an independent reader for Hacker News, built on the public HN API. Not affiliated with Y Combinator.