Documentation
¶
Overview ¶
Package fileload contains commonly used file loading functions. For human-created files (eg, config files), I'd suggest using TOML (https://github.com/BurntSushi/toml), specifically for comment support and improved readability.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func JSON ¶
JSON reads a file at the given location and attempts to unmarshal it as JSON with the given type. The generic type adds more convenience so you can simplify file loading down to something like:
cfg, err := fileload.JSON[ServiceCfg]("cfg.json") logging.FatalIfError(err, "loading service config")
ie, this saves you a line of explicitly declaring a var, because we'll declare it and return a pointer here.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.