Documentation ¶
Overview ¶
Package diag contains building blocks for formatting and processing diagnostic information.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Complain ¶
func Complain(msg string)
Complain prints a message to stderr in bold and red, adding a trailing newline.
func Complainf ¶
func Complainf(format string, args ...interface{})
Complainf is like Complain, but accepts a format string and arguments.
func PPrintError ¶
func PPrintError(err error)
PPrintError pretty-prints an error. It uses the PPrint method if the error implements PPrinter, and uses Complain to print the error message otherwise.
Types ¶
type Context ¶
Context is a range of text in a source code. It is typically used for errors that can be associated with a part of the source code, like parse errors and a traceback entry.
func NewContext ¶
NewContext creates a new Context.
func (*Context) PPrintCompact ¶
PPrintCompact pretty-prints a SourceContext, with no line break between the source position range description and relevant source excerpt.
type Error ¶
Error represents an error with context that can be pretty-printed.