Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> Use the right tool for the job.

Do you agree with the article's recommendation of Rust for command-line tools, or do you think Go is the right tool for that job as well?

Or perhaps I should stick with C++? For one thing, it's nice to be able to re-use code between command-line tools and other C++ programs, which AFAICT would be a bit harder between Rust & C++ and much harder between Go & C++.



I’m not the one you asked, but I think go is also a fine language for command-line tools, thanks to is truly breezy cross-compilation story.


The ability to trivially cross-compile in Go, and get a single-file executable artifact, is often mentioned but still not appreciated enough. This is still a multi-hour project, minimum, for most languages, especially if you are introducing a second platform to a well-established project. In Go, it‘s a compiler flag.

I think between http, encoding/json, and the io libraries, it’s also very simple and straightforward to do most of the things a typical command-line program does, in a cleaner way than shell or Python (both have their place) and with less fuss than Rust or C++.


There's a relatively large difference in executable size, which might matter in some situations. And in run time. For executables that can get put to task doing a lot of heavy lifting and hammering on memory resources like grep and awk and others, it might make a real difference.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: