News for hackers. Stuff that matters.
Re:Thoughts on Go vs. Rust vs. Zig by YmiYugy on Thursday December 04, 2025 @06:30PM (#46154762)
What is the context that the Go code adds here? When File::create or os.Create fails the errors they return already contain the information what and why something failed. So what information does "failed to create file: " add?
Re:Thoughts on Go vs. Rust vs. Zig by edflsafoiewq on Thursday December 04, 2025 @06:34PM (#46154800)
The error from Rust's File::create basically only contains the errno result. So it's eg. "permission denied" vs "failed to create file: permission denied".
Re:Thoughts on Go vs. Rust vs. Zig by Mawr on Thursday December 04, 2025 @10:51PM (#46156685)
Whatever context you deem appropriate at the time of writing that message. Don't overfocus on the example. It could be the request ID, the customer's name — anything that's relevant to that particular call.
Re:Thoughts on Go vs. Rust vs. Zig by YmiYugy on Friday December 05, 2025 @08:33AM (#46161043)
Well if there is useful context Rust let's you add it. You can easily wrap the io error in something specific to your application or just use anyhow with .context("...")? which is what most people do in application code.