Documentation ¶
Overview ¶
Package vdlutil implements utilities used by many VDL components. It should have a small set of dependencies.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( // Vlog is a logger that discards output by default, and only outputs real // logs when SetVerbose is called. Vlog = log.New(ioutil.Discard, logPrefix, logFlags) )
Functions ¶
func FirstRuneToExportCase ¶
FirstRuneToExportCase returns s with its first rune in uppercase if export is true, otherwise in lowercase.
func FirstRuneToLower ¶
FirstRuneToLower returns s with its first rune in lowercase.
func FirstRuneToUpper ¶
FirstRuneToUpper returns s with its first rune in uppercase.
func SetVerbose ¶
func SetVerbose()
SetVerbose tells the vdl package (and subpackages) to enable verbose logging.
func ToConstCase ¶
toConstCase converts ThisString to THIS_STRING. For adding '_', we follow the following algorithm. For any sequence of three characters, c[n-1], c[n], c[n+1], we add an underscore before c[n] if:
- c[n-1] is a digit and c[n] is a letter, or
- c[n-1] is a letter and c[n] is a digit, or
- c[n-1] is lowercase, and c[n] is uppercase, or
- c[n-1] is uppercase, c[n] is uppercase, and c[n+1] is lowercase.
Types ¶
type Errors ¶
type Errors struct { MaxErrors int // contains filtered or unexported fields }
Errors holds a buffer of encountered errors. The point is to try displaying all errors to the user rather than just the first. We cutoff at MaxErrors to ensure if something's really messed up we won't spew errors forever. Set MaxErrors=-1 to effectively continue despite any number of errors. The zero Errors struct stops at the first error encountered.
func (*Errors) Error ¶
Error adds the error described by msg to the buffer. Returns true iff we're still under the MaxErrors cutoff.
func (*Errors) Reset ¶
func (e *Errors) Reset()
Reset clears the internal state so you start with no buffered errors. MaxErrors remains the same; if you want to change it you should create a new Errors struct.