config

package
v0.0.0-...-52b58a3 Latest Latest
Warning

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

Go to latest
Published: Jan 31, 2022 License: Apache-2.0, Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package config provides functions for parsing INI configuration files.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrSyntax

type ErrSyntax struct {
	Line   int
	Source string // The contents of the erroneous line, without leading or trailing whitespace
}

ErrSyntax is returned when there is a syntax error in an INI file.

func (ErrSyntax) Error

func (e ErrSyntax) Error() string

type File

type File map[string]Section

A File represents a parsed INI file.

func Load

func Load(in io.Reader) (File, error)

Loads and returns a File from a reader.

func LoadFile

func LoadFile(filename string) (File, error)

Loads and returns an INI File from a file on disk.

func (File) Get

func (f File) Get(section, key string) (value string, ok bool)

Looks up a value for a key in a section and returns that value, along with a boolean result similar to a map lookup.

func (File) Load

func (f File) Load(in io.Reader) error

Loads INI data from a reader and stores the data in the File.

func (File) LoadFile

func (f File) LoadFile(file string) (err error)

Loads INI data from a named file and stores the data in the File.

func (File) Section

func (f File) Section(name string) Section

Returns a named Section. A Section will be created if one does not already exist for the given name.

type Section

type Section map[string]string

A Section represents a single section of an INI file.

Jump to

Keyboard shortcuts

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