gommon icon indicating copy to clipboard operation
gommon copied to clipboard

[error] Support fmt.Formatter interface

Open at15 opened this issue 7 years ago • 3 comments

I am used to log.Warnf("err %v", err), but since we didn't implement formatter interface, the result is just struct ... it's quite a pain to call err.Error everytime

  • https://golang.org/pkg/fmt/#Formatter
type Formatter interface {
        Format(f State, c rune)
}
  • [ ] does %w need some extra handling?
  • [x] print string #63
  • [ ] print stack
  • [ ] pass format to inner error and multi error
  • [ ] it seems non standard formatter is also possible?

at15 avatar Mar 06 '18 02:03 at15

强无敌

gaocegege avatar Mar 06 '18 02:03 gaocegege

the print interface seems also changed with new x/errors #109

at15 avatar Apr 13 '19 21:04 at15

Although it is important ... won't hurt without its full implementation ... so moved it to 0.0.14

at15 avatar Jan 18 '20 07:01 at15