Brian McGee
b109358490
Move all config related code into a config package. Signed-off-by: Brian McGee <brian@bmcgee.ie> Reviewed-on: #25 Reviewed-by: Jonas Chevalier <zimbatm@noreply.git.numtide.com> Co-authored-by: Brian McGee <brian@bmcgee.ie> Co-committed-by: Brian McGee <brian@bmcgee.ie>
19 lines
512 B
Go
19 lines
512 B
Go
package config
|
|
|
|
import "github.com/BurntSushi/toml"
|
|
|
|
// Config is used to represent the list of configured Formatters.
|
|
type Config struct {
|
|
Global struct {
|
|
// Excludes is an optional list of glob patterns used to exclude certain files from all formatters.
|
|
Excludes []string
|
|
}
|
|
Formatters map[string]*Formatter `toml:"formatter"`
|
|
}
|
|
|
|
// ReadFile reads from path and unmarshals toml into a Config instance.
|
|
func ReadFile(path string) (cfg *Config, err error) {
|
|
_, err = toml.DecodeFile(path, &cfg)
|
|
return
|
|
}
|