Documentation ¶
Overview ¶
Package config implements configuration file parsing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ParseFile ¶
ParseFile parses the configuration in the file specified by name and stores the result in the value pointed to by v.
func ParseString ¶
ParseString parses the configuration in s and stores the result in the value pointed to by v.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
A Decoder represents a configuration parser reading a particular input stream. The parser assumes that its input is encoded in UTF-8.
func NewDecoder ¶
NewDecoder creates a new configuration parser reading from r.
func (*Decoder) Decode ¶
Decode parses the configuration and stores the result in the value pointed to by v.
Decode implements the following PEG.
INI = ((KEYWORD WS* '=' WS* VALUE) / COMMENT / WS)* KEYWORD = ALPHA (ALPHA / NUMERIC / '_' / '.')* VALUE = QUOTED / DQUOTED / RAW QUOTED = '\” .* '\” DQUOTED = '"' .* '"' RAW = .* EOL COMMENT = ('#' / ';') .* EOL
type FlagParserShim ¶
type FlagParserShim struct {
// contains filtered or unexported fields
}
FlagParserShim is a flag.Value that unmarshals flag values using ParseString()
func NewFlagParserShim ¶
func NewFlagParserShim(v interface{}) *FlagParserShim
NewFlagParserShim creates a FlagParserShim from a pointer.
func (*FlagParserShim) Set ¶
func (cv *FlagParserShim) Set(s string) error
Set parses a configuration setting value.
func (*FlagParserShim) String ¶
func (cv *FlagParserShim) String() string
String always returns an empty string. It's implemented to satisfy the flag.Value interface.
type Timeout ¶
type Timeout int64
A Timeout specifies a time limit as a non-negative int64 nanosecond count. The representation limits the largest representable time limit to approximately 290 years.
func (Timeout) String ¶
String returns a string representing the timeout in the form "72h3m0.5s". Leading zero units are omitted. As a special case, durations less than one second format use a smaller unit (milli-, micro-, or nanoseconds) to ensure that the leading digit is non-zero. The zero duration formats as 0s.
func (*Timeout) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface. The timeout is expected to be non-negative. Terms without a unit are interpreted as seconds.