mirror of
https://github.com/ScuroNeko/mtg.git
synced 2026-09-01 05:54:01 +03:00
Small improvements for config parsing
This commit is contained in:
+2
-2
@@ -148,11 +148,11 @@ func Parse(rawData []byte) (*Config, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if err := jsonEncoder.Encode(rawConf); err != nil {
|
if err := jsonEncoder.Encode(rawConf); err != nil {
|
||||||
return nil, fmt.Errorf("cannot dump into interim format: %w", err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := json.NewDecoder(jsonBuf).Decode(conf); err != nil {
|
if err := json.NewDecoder(jsonBuf).Decode(conf); err != nil {
|
||||||
return nil, fmt.Errorf("cannot parse final config: %w", err)
|
return nil, fmt.Errorf("cannot parse a config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := conf.Validate(); err != nil {
|
if err := conf.Validate(); err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user