smallcfg

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2020 License: BSD-3-Clause Imports: 4 Imported by: 1

README

smallcfg

Small function to load a configuration from a JSON file and return a pointer to a struct. I use it so often I might as well just make a quick importable package so I don't have to keep copy/pasting it. Maybe I'll make it a fully fledged thing someday.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Load

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

Load reads a json file from the given file path and loads it into memory given the interface.

func Save

func Save(path string, config interface{}, pretty bool) error

Save accepts a configuration interface type and writes it to a file in json format. Caller can specify whether or not to write the json "pretty" printed using indentation by specifying true or false to the pretty parameter.

Types

This section is empty.

Jump to

Keyboard shortcuts

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