configReader

package module
v0.0.0-...-188a03b Latest Latest
Warning

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

Go to latest
Published: Aug 2, 2017 License: MIT Imports: 8 Imported by: 1

README

Config Reader

Build Status Coverage Status

Simple Unix-style config file reader. Handles single-quotes, double-quotes, multi-line, $variable, #comment, etc

Getting Started

go get https://github.com/robarchibald/configReader
  1. Create a Go struct that will hold your configuration data (typically mirroring the config parameters you want to access from the config file)
  2. Call configReader.ReadFile(pathToConfigFile, pointerToYourConfigurationStruct)
  3. Use your values from the struct (e.g. fmt.Println(pointerToYourConfigurationStruct.Value1))

Example

type MyConfigStructure struct {
	Value1 string
	Value2 int
}
    
config := &MyConfigStructure{}
configReader.ReadFile(pathToFile, config)
fmt.Println(config.Value1)

For additional examples, see configReader_test.go

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReadFile

func ReadFile(path string, outStruct interface{}) error

Types

This section is empty.

Jump to

Keyboard shortcuts

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