zlacker

[parent] [thread] 2 comments
1. jjice+(OP)[view] [source] 2024-09-27 13:29:14
Sorry for the nitpick but I'm curious if I'm off here:

> that's why newer languages like Go and Rust force you to check errors in return values

Go doesn't require you check return values though, no? I can get a return of type (*Model, error) and just completely ignore the error portion of it and never check it. Rust doesn't let you access the value until you deal with the Result/Option wrapper, requiring that you at least acknowledge the potential for an error.

replies(2): >>jakevo+s4 >>tredre+TU1
2. jakevo+s4[view] [source] 2024-09-27 13:53:09
>>jjice+(OP)
The language doesn't force it but some common tooling does. They probably are using something like staticcheck in their setup and conflating it with the core language.
3. tredre+TU1[view] [source] 2024-09-28 03:14:52
>>jjice+(OP)
You can ignore it but the compiler will force you to assign it to something, usually `_`. That alone is helpful in reminding the programmer that return values need to thought of, but in addition you have pretty much all Go linters/analyzers force you to check its value and not use `_`.
[go to top]