acconfig

package module
v0.0.0-...-958dc82 Latest Latest
Warning

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

Go to latest
Published: Jan 29, 2024 License: BSD-3-Clause Imports: 11 Imported by: 1

README

* go package to read config file

* Example
#+begin_src go
import "github.com/jaw0/acconfig"

type Thing struct {
    Name string
    Size int32
}

type Config struct {
    Field    string
    Field2   string `ac/name:"girth"`
    Value    int32
    Doit     bool
    Flag     map[string]bool
    Tag      []string
    Start    time.Time
    Elapsed  time.Duration
    Thing    []*Thing
}

var cf Config
err := acconfig.Read("/path/file", &cf)

#+end_src

#+begin_src conf
field    value
value    123
doit     yes
start    2024-01-01T02:03:04Z
elapsed  1m
girth    "very very"	# important comment

# another important comment
flag slithytove
flag borogrove

tag  bandersnatch
tag  jubjubtree

thing {
    name    momerath
    size    123
}

# read more config
include "more.conf"

#+end_src

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Read

func Read(file string, cf interface{}) error

Read reads a config file into the struct

Types

This section is empty.

Jump to

Keyboard shortcuts

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