remove no need pointer

This commit is contained in:
yuzuki999 2023-09-02 17:34:55 +08:00
parent 946e130997
commit 38081e14c2

View File

@ -10,8 +10,8 @@ type NodeConfig struct {
} }
type rawNodeConfig struct { type rawNodeConfig struct {
ApiRaw *json.RawMessage `json:"ApiConfig"` ApiRaw json.RawMessage `json:"ApiConfig"`
OptRaw *json.RawMessage `json:"Options"` OptRaw json.RawMessage `json:"Options"`
} }
type ApiConfig struct { type ApiConfig struct {
@ -29,8 +29,8 @@ func (n *NodeConfig) UnmarshalJSON(data []byte) (err error) {
if err != nil { if err != nil {
return err return err
} }
if r.ApiRaw != nil { if len(r.ApiRaw) > 0 {
err = json.Unmarshal(*r.ApiRaw, &n.ApiConfig) err = json.Unmarshal(r.ApiRaw, &n.ApiConfig)
if err != nil { if err != nil {
return return
} }
@ -44,9 +44,8 @@ func (n *NodeConfig) UnmarshalJSON(data []byte) (err error) {
return return
} }
} }
if r.OptRaw != nil { if len(r.OptRaw) > 0 {
data = *r.OptRaw err = json.Unmarshal(r.OptRaw, &n.Options)
err = json.Unmarshal(data, &n.Options)
if err != nil { if err != nil {
return return
} }