fix(config): always strip comments from json

This commit is contained in:
Jan De Dobbeleer 2024-03-12 15:35:39 +01:00 committed by Jan De Dobbeleer
parent ae806a1942
commit 8e2419452c

View file

@ -143,13 +143,11 @@ func loadConfig(env platform.Environment) *Config {
cfg.Format = YAML
err = yaml.Unmarshal(data, &cfg)
case "jsonc", "json":
if cfg.Format == "jsonc" {
str := jsonutil.StripComments(string(data))
data = []byte(str)
}
cfg.Format = JSON
str := jsonutil.StripComments(string(data))
data = []byte(str)
decoder := json.NewDecoder(bytes.NewReader(data))
err = decoder.Decode(&cfg)
case "toml", "tml":