Go to file
Sean Hickey 4dfcff507f Rename to gosimpleconf 2022-02-21 22:47:36 -08:00
.gitignore Was this seriously simple enough for me to do in one commit? 2022-02-21 22:26:38 -08:00
License.md Was this seriously simple enough for me to do in one commit? 2022-02-21 22:26:38 -08:00
Makefile Move files out of pkg into root 2022-02-21 22:39:32 -08:00
Readme.md Rename to gosimpleconf 2022-02-21 22:47:36 -08:00
go.mod Rename to gosimpleconf 2022-02-21 22:47:36 -08:00
simpleconf.go Rename to gosimpleconf 2022-02-21 22:47:36 -08:00
simpleconf_test.go Rename to gosimpleconf 2022-02-21 22:47:36 -08:00

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).