Documentation
¶
Overview ¶
Package debug is a Sidero-specific library for including debugging facilities for developers in our products when they are compiled with sidero.debug build tag. They are not included by default. Also provides utils for detecting if the code was compiled with race build tag.
Index ¶
Constants ¶
const Enabled = false
Enabled is false when compiled without sidero.debug build tag.
Profiling is disabled to safe resources as a side-effect of importing this package.
const RaceEnabled = false
RaceEnabled is false when compiled without race build tag.
Variables ¶
This section is empty.
Functions ¶
func ListenAndServe ¶
ListenAndServe runs debug server on given address.
If debugging is enabled (debug.Enabled is true), the function blocks until fatal error in encountered (it is returned) or ctx is canceled (in that case, nil is returned).
If debugging is disabled (debug.Enabled is false), the function immediately returns nil.
Both cases can be handled with the following code:
if err := debug.ListenAndServe(ctx, addr, log); err != nil { log.Fatal(err) }