configo

package module
v0.0.0-...-12f9555 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2015 License: MIT Imports: 10 Imported by: 0

README

Configo

Introduction

Configo provides an easy way to read configuration files in JSON, XML or YAML.

Documentation

https://godoc.org/github.com/alexcesaro/configo

Download

go get github.com/alexcesaro/configo

Example

package main

import (
	"fmt"

	"github.com/alexcesaro/configo"
)

func main() {
	var conf struct {
		User     string // Field names must start with an uppercase letter
		Password string
	}
	err := configo.Load("config.json", &conf)
	if err != nil {
		panic(err)
	}
	fmt.Println(conf.User, conf.Password)
}

Documentation

Overview

Package configo provides an easy way to read configuration files in JSON, XML or YAML.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsNotFound

func IsNotFound(err error) bool

IsNotFound returns whether the error means the config file was not found.

func Load

func Load(filename string, config interface{}) error

Load loads the file pointed by filename and write the data to config.

func LoadNode

func LoadNode(filename, node string, config interface{}) error

LoadNode loads the given node of a file and write the data to config. It currently only supports YAML config files.

Types

This section is empty.

Jump to

Keyboard shortcuts

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