#What config files is there for Go?

1 messages · Page 1 of 1 (latest)

stuck hamlet
#

I was thinking of JSON but then that doesn't have types idk this is the best option

robust iris
#

json has types.
At least string, float and integer.
And if you build a conversion function, you can even save other datatypes and customs.
Which then on load you can create objects from.

Did that with python and with a sqlite db for my objects meeded as local save.

pallid garden
#

YAML, TOML, Pkl

regal hazel
#

What serious configuration format has types? If you need types you define them as models in your code

#

Probably as a struct in Go

frail jasper
#

yeah, just validate when you load the config

regal hazel
#

Oh is xml typed?

pallid garden
#

(e.g. all values are custom objects that have a type field and a value field)

regal hazel
#

Well XML has a schema format XSD that allows you to more or less assign types to elements and attributes

pallid garden
#

custom objects 🤢

proper skiff
#

JSON is in the standard library though so you might prefer that

stuck hamlet
#

There is already some Toml in the project I might just continue with it