Sean Hickey 4dfcff507f | ||
---|---|---|
.gitignore | ||
License.md | ||
Makefile | ||
Readme.md | ||
go.mod | ||
simpleconf.go | ||
simpleconf_test.go |
Readme.md
gosimpleconf
This is a small library for parsing super simple configuration files.
It expects a file with the following format:
- Lines with key-values pairs separated by
=
(e.g.foo = bar
) - Lines that start with
#
are ignored (used for comments) - Empty and whitespace-only lines are ignore
- Lines with data that don't have an
=
will cause an error.
The key-values pairs are simply parsed as strings and plopped into a
map for you to do whatever your program wants with them. If you need a
value to not be a string, you will have to convert the value from a
string as needed for your program (e.g. using the strconv
library).
Why?
I've always seen configuration files similar to this show up in
Unix-like systems and programs, but it doesn't seem to be fully
standardized under a real name other than just "conf files". The
closest I've seen are INI files, but those don't seem to fit the style
I was looking for (they don't use #
for comments and they support
sections in square brackets [section]
).
Instead, I just wanted the bare minimum configuration format of foo = bar
on each line with #
for comments. So that's what this library
does.
This project looks abandoned
This library is so simple that I almost never expect to need to update it unless Go fundamentally breaks the language in the future. So while the project may eventually look like it has been abandoned, it is rather simply "complete". (gasp I know, such a rare thing in the software world).