Documentation ¶
Overview ¶
Package q provides quick and dirty debugging output for tired programmers.
q.Q() is a fast way to pretty-print variables. It's easier than typing fmt.Printf("%#v", whatever). The output will be colorized and nicely formatted. The output goes to $TMPDIR/$USER.q, away from the noise of stdout.
q exports a single Q() function. This is how you use it:
import "q" ... q.Q(a, b, c)
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // CallDepth allows setting the number of levels runtime.Caller will // skip when looking up the caller of the q.Q function. This allows // the `q` package to be wrapped by a project-specific wrapping function, // which would increase the depth by at least one. It's better to not // include calls to `q.Q` in released code at all and scrub them before, // a build is created, but in some cases it might be useful to provide // builds that do include the additional debug output provided by `q.Q`. // This also allows the consumer of the package to control what happens // with leftover `q.Q` calls. Defaults to 2, because the user code calls // q.Q(), which calls getCallerInfo(). CallDepth = 3 )
Functions ¶
func AppendFile ¶
AppendFile appends data to a file.
func D ¶
func D(v ...interface{})
D pretty-prints the given arguments to the $TMPDIR/$USER.q log file when export Q=1
func MergeErrors ¶
MergeErrors merges multiple errors into a single error.
func Q ¶
func Q(v ...interface{})
Q pretty-prints the given arguments to the $TMPDIR/$USER.q log file.
func Quote ¶
Quote returns a shell-escaped version of the string s. The returned value is a string that can safely be used as one token in a shell command line.
func QuoteCommand ¶
QuoteCommand returns a shell-escaped version of the slice of strings. The returned value is a string that can safely be used as shell command arguments.
Types ¶
type MultiError ¶
type MultiError []error
MultiError represents an error that aggregates multiple errors.
func (MultiError) Error ¶
func (m MultiError) Error() string
Error implements the error interface for MultiError.