config

package
v0.0.0-...-0bf5eaf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 2, 2012 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidOption        = errors.New("invalid option")
	ErrInvalidSectionHeader = errors.New("invalid section header")
)

These are the errors that can be returned in ParseError.Error.

Functions

This section is empty.

Types

type ParseError

type ParseError struct {
	Line   int   // Line where the error occurred
	Column int   // Column (rune index) where the error occurred
	Err    error // The actual error
}

A ParseError is returned for parsing errors. The first line is 1. The first column is 1.

func (*ParseError) Error

func (e *ParseError) Error() string

type Reader

type Reader struct {
	// contains filtered or unexported fields
}

A Reader reads sections of options from a configuration file.

func NewReader

func NewReader(r io.Reader) *Reader

NewReader returns a new Reader that reads from r.

func (*Reader) ReadAll

func (r *Reader) ReadAll() (sections map[string]map[string]string, err error)

ReadAll reads all the sections from r. Each section is a map. A successful call returns err == nil, not err == EOF. Because ReadAll is defined to read until EOF, it does not treat end of file as an error to be reported.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL