Every Go developer has written this code thousands of times:
data, err := os.ReadFile(path) if err != nil { return nil, err }
And every Go developer has at some point looked at Zig or Rust and felt a pang of envy:
const data = try readFile(path);
One line. Clean. Honest. So why doesn't Go just do this? The common answer is "the Go team likes explicitness." That's true, but it's not the whole story. The real answer runs much deeper.
Zig Is Actually More Explicit Than Go
Here's the irony nobody talks about: Zig is more explicit about errors than Go, not less.
In Zig, a function's return type tells you everything before you read a single line of its body. !Config means this function can fail. The compiler knows every possible error it can return. If you don't handle a case, it won't compile. try isn't hiding anything, it's saying clearly "I see this can fail, and I'm intentionally propagating it upward."
Go's if err != nil , on the other hand, is not actually enforced by the language. This compiles just fine:
data, _ := os.ReadFile(path)
... continue reading