cockroachdb / errors

Go error library with error portability over the network
Apache License 2.0
2.07k stars 66 forks source link

Is this space in the formatting verb correct? #93

Closed StevenACoffman closed 2 years ago

StevenACoffman commented 2 years ago

Sorry, but my reading of the code, can you confirm whether the space character is intended? I would think that "%# v" should instead be "%#v" in: https://github.com/cockroachdb/errors/blob/master/errbase/format_error.go#L122

Go offers several printing “verbs” designed to format general Go values.

If the value is a struct, the %+v variant will include the struct’s field names. The %#v variant prints a Go syntax representation of the value, i.e. the source code snippet that would produce that value.

knz commented 2 years ago

Yes it is correct, it's a special flag recognized by the kr/pretty library.

StevenACoffman commented 2 years ago

Thanks!