Skip to content

Commit 0b42f26

Browse files
committed
Fix rule-set format
1 parent 93dfc30 commit 0b42f26

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

option/rule_set.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -48,17 +48,6 @@ func (r *RuleSet) UnmarshalJSON(bytes []byte) error {
4848
if r.Tag == "" {
4949
return E.New("missing tag")
5050
}
51-
if r.Type != C.RuleSetTypeInline {
52-
switch r.Format {
53-
case "":
54-
return E.New("missing format")
55-
case C.RuleSetFormatSource, C.RuleSetFormatBinary:
56-
default:
57-
return E.New("unknown rule-set format: " + r.Format)
58-
}
59-
} else {
60-
r.Format = ""
61-
}
6251
var v any
6352
switch r.Type {
6453
case "", C.RuleSetTypeInline:
@@ -71,6 +60,17 @@ func (r *RuleSet) UnmarshalJSON(bytes []byte) error {
7160
default:
7261
return E.New("unknown rule-set type: " + r.Type)
7362
}
63+
if r.Type != C.RuleSetTypeInline {
64+
switch r.Format {
65+
case "":
66+
return E.New("missing format")
67+
case C.RuleSetFormatSource, C.RuleSetFormatBinary:
68+
default:
69+
return E.New("unknown rule-set format: " + r.Format)
70+
}
71+
} else {
72+
r.Format = ""
73+
}
7474
err = UnmarshallExcluded(bytes, (*_RuleSet)(r), v)
7575
if err != nil {
7676
return err

0 commit comments

Comments
 (0)