Post AiBbqmD9aU0fZ1VFS4 by pkw@mastodon.sdf.org
(DIR) More posts by pkw@mastodon.sdf.org
(DIR) Post #AiBbqjroIrkUIFVAuG by galdor@emacs.ch
2024-05-23T10:10:22Z
0 likes, 0 repeats
If you are complaining about the `if err != nil { return err }` pattern in #Go, you are doing it wrong. You are almost always supposed to wrap errors (`return fmt.Errorf("cannot do X: %w", err)`). This is how you get these precise error messages that are so useful.
(DIR) Post #AiBbql3trP0u02ALOC by veer66@mstdn.in.th
2024-05-23T11:48:19Z
0 likes, 0 repeats
@galdor Still, it takes 3 lines.
(DIR) Post #AiBbqmD9aU0fZ1VFS4 by pkw@mastodon.sdf.org
2024-05-23T12:23:02Z
0 likes, 0 repeats
@veer66 @galdor I always liked golang's deliberate and explicit error handling.I use this helper library so I can gather errors as I go, but only care about any one of them failing.I haven't used golang much since the new error wrapping happened so I don't know it it's still idiomatic.https://codeberg.org/pkw/any/src/branch/main/any.go
(DIR) Post #AiBbqnEbmYlejpBvMG by veer66@mstdn.in.th
2024-05-23T12:30:23Z
0 likes, 0 repeats
@pkw Me too. I like that it is clear. However , it lacks of brevity. @galdor
(DIR) Post #AiBbqoAOJizLd2E4QK by galdor@emacs.ch
2024-05-23T12:42:21Z
0 likes, 0 repeats
@veer66 @pkw Yes Go is verbose, no argument here. Never said I loved the language. But I liked getting things done.As for the library linked above, it's idiomatic to avoid piling up non-standard libraries ;) But as usual, your code, your choices; who cares if it's idiomatic or not?
(DIR) Post #AiBbqomK2hKVWfyMXw by amerika@annihilation.social
2024-05-23T15:01:01.025202Z
0 likes, 0 repeats
@galdor @veer66 @pkw only perl is real