3 ms·
>Secondly why is this really important functionality in `fmt` and not in `error`? `fmt` already depends on `errors`, and Go does not allow cyclical dependencie
by insertnickname 7y ago
>Secondly why is this really important functionality in `fmt` and not in `error`?
`fmt` already depends on `errors`, and Go does not allow cyclical dependencies, so `errors` would have to reimplement string formatting.
- masklinn 7y agoOr they could move the machinery into a shared module. Which already exists incidentally, internal/errinternal was added so errors.New and fmt.Errorf could return the same type. It does make errors pull the entire formatting machinery, but chances are you're probably using string formatting long before errors so meh…
- lugg 7y agoThat's not an argument for putting it in fmt. That's an argument for putting it in the language layer or putting it in its own place.
- erik_seaberg 7y agoWhy? Go permits mutual recursion, and "go tool link" seems to support separate compilation that would resolve that cycle.