Remove go-json

This commit is contained in:
世界
2022-07-26 13:53:25 +08:00
parent 75508bccb5
commit 0347a7c038
10 changed files with 14 additions and 40 deletions

View File

@@ -58,12 +58,10 @@ func (r *DNSRule) UnmarshalJSON(bytes []byte) error {
if err != nil {
return err
}
if r.Type == "" {
r.Type = C.RuleTypeDefault
}
var v any
switch r.Type {
case C.RuleTypeDefault:
case "", C.RuleTypeDefault:
r.Type = C.RuleTypeDefault
v = &r.DefaultOptions
case C.RuleTypeLogical:
v = &r.LogicalOptions

View File

@@ -35,9 +35,7 @@ func MergeObjects(objects ...any) (*badjson.JSONObject, error) {
}
func MarshallObjects(objects ...any) ([]byte, error) {
objects = common.Filter(objects, func(v any) bool {
return v != nil
})
objects = common.FilterNotNil(objects)
if len(objects) == 1 {
return json.Marshal(objects[0])
}