Fix rule-set upgrade command

This commit is contained in:
世界 2025-01-27 09:24:55 +08:00
parent 08c1ec4b7e
commit eeb37d89f1
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -61,14 +61,15 @@ func upgradeRuleSet(sourcePath string) error {
log.Info("already up-to-date") log.Info("already up-to-date")
return nil return nil
} }
plainRuleSet, err := plainRuleSetCompat.Upgrade() plainRuleSetCompat.Options, err = plainRuleSetCompat.Upgrade()
if err != nil { if err != nil {
return err return err
} }
plainRuleSetCompat.Version = C.RuleSetVersionCurrent
buffer := new(bytes.Buffer) buffer := new(bytes.Buffer)
encoder := json.NewEncoder(buffer) encoder := json.NewEncoder(buffer)
encoder.SetIndent("", " ") encoder.SetIndent("", " ")
err = encoder.Encode(plainRuleSet) err = encoder.Encode(plainRuleSetCompat)
if err != nil { if err != nil {
return E.Cause(err, "encode config") return E.Cause(err, "encode config")
} }