From 9a422549b127d156a1e897ebbe736c15acc84ebb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Wed, 7 Sep 2022 13:19:57 +0800 Subject: [PATCH] Fix json format error message --- cmd/sing-box/cmd_format.go | 2 +- cmd/sing-box/cmd_run.go | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cmd/sing-box/cmd_format.go b/cmd/sing-box/cmd_format.go index 5a811a90..47b8a00a 100644 --- a/cmd/sing-box/cmd_format.go +++ b/cmd/sing-box/cmd_format.go @@ -38,7 +38,7 @@ func format() error { return E.Cause(err, "read config") } var options option.Options - err = json.Unmarshal(configContent, &options) + err = options.UnmarshalJSON(configContent) if err != nil { return E.Cause(err, "decode config") } diff --git a/cmd/sing-box/cmd_run.go b/cmd/sing-box/cmd_run.go index 6298387d..77572ff6 100644 --- a/cmd/sing-box/cmd_run.go +++ b/cmd/sing-box/cmd_run.go @@ -9,7 +9,6 @@ import ( "syscall" "github.com/sagernet/sing-box" - "github.com/sagernet/sing-box/common/json" "github.com/sagernet/sing-box/log" "github.com/sagernet/sing-box/option" E "github.com/sagernet/sing/common/exceptions" @@ -46,7 +45,7 @@ func readConfig() (option.Options, error) { return option.Options{}, E.Cause(err, "read config") } var options option.Options - err = json.Unmarshal(configContent, &options) + err = options.UnmarshalJSON(configContent) if err != nil { return option.Options{}, E.Cause(err, "decode config") }