DEV Community

Tymoteusz Blazejczyk
Tymoteusz Blazejczyk

Posted on

Go Error

Tired of using boring #Go errors.New?

Try the latest Go Error package today. It implements replacement fields surrounded by curly braces {} format strings similar to Python string format.

Features:

  • Implements replacement fields surrounded by curly braces {} format strings
  • Format string by providing arguments without using placeholders or format verbs %
  • Format string using automatic placeholder {p}
  • Format string using positional placeholders {pN}
  • Format string using named placeholders {name}
  • Format string using object placeholders {.Field}, {p.Field} and {pN.Field} where Field is an exported struct field or method
  • Set custom format error message string. Default is {.BaseFile}:{.Line}:{.BaseFunction}(): {.Message}
  • Error message contains file path, line number, function name from where was called
  • Compatible with the standard errors package with As, Is and Unwrap functions
  • It uses the Go Formatter library

Top comments (0)