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

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

Engage with a wealth of insights in this thoughtful article, valued within the supportive DEV Community. Coders of every background are welcome to join in and add to our collective wisdom.

A sincere "thank you" often brightens someone’s day. Share your gratitude in the comments below!

On DEV, the act of sharing knowledge eases our journey and fortifies our community ties. Found value in this? A quick thank you to the author can make a significant impact.

Okay