"Is Rust a great fit for this project?" I get this question quite frequently so I think it's time to write down my thoughts if it can avoid you some painful and costly mistakes. Short answer: no. Coming from someone who wrote a successful book about Rust (Black Hat Rust)
Depending on how your logical flow works, this can end up causing bugs in a very surprising and hard to detect way.
Also, you can call methods on nil values, like this:
type A int
func (a *A) doStuff() {
*a = 3
}
var a *A = nil
a.doStuff()
This panics inside doStuff, not at the call site, which can mean functions could run fine and fail later, making it harder to track down the nil value.
There’s a lot of other footguns, especially as you get into multithreading. I started building code with Go back at 1.0, and they didn’t turn on multithreading by default until 1.4 or 1.5 (I forget which), at which point our assumption that the built-in map type was multithreading-safe didn’t hold (at least for assignments and reads). That was in the documentation, but the fact that it worked fine for multiple releases made it that much worse.
I still think Go is a fine language, but it should be limited to smaller scale projects like microservices because there are enough gotchas that the simplicity of the language hides for me to not recommend it.
I don’t mind the error handling in Go, what bothers me is a bunch of safety issues. For example:
Depending on how your logical flow works, this can end up causing bugs in a very surprising and hard to detect way.
Also, you can call methods on nil values, like this:
This panics inside doStuff, not at the call site, which can mean functions could run fine and fail later, making it harder to track down the nil value.
There’s a lot of other footguns, especially as you get into multithreading. I started building code with Go back at 1.0, and they didn’t turn on multithreading by default until 1.4 or 1.5 (I forget which), at which point our assumption that the built-in
map
type was multithreading-safe didn’t hold (at least for assignments and reads). That was in the documentation, but the fact that it worked fine for multiple releases made it that much worse.I still think Go is a fine language, but it should be limited to smaller scale projects like microservices because there are enough gotchas that the simplicity of the language hides for me to not recommend it.