From c9fa690601e404a25dc07182eb0984443b53d450 Mon Sep 17 00:00:00 2001 From: wwqgtxx Date: Sun, 1 Sep 2024 00:22:56 +0800 Subject: [PATCH] remove depend of gopkg.in/yaml.v2 --- core/src/main/golang/go.mod | 3 +-- core/src/main/golang/go.sum | 2 -- core/src/main/golang/native/config/load.go | 6 +++--- core/src/main/golang/native/config/override.go | 4 ++-- 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/core/src/main/golang/go.mod b/core/src/main/golang/go.mod index 3c85007d..9786cb70 100644 --- a/core/src/main/golang/go.mod +++ b/core/src/main/golang/go.mod @@ -9,7 +9,7 @@ require ( github.com/miekg/dns v1.1.62 github.com/oschwald/maxminddb-golang v1.12.0 golang.org/x/sync v0.8.0 - gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v3 v3.0.1 ) replace github.com/metacubex/mihomo => ../../foss/golang/clash @@ -111,6 +111,5 @@ require ( golang.org/x/time v0.5.0 // indirect golang.org/x/tools v0.24.0 // indirect google.golang.org/protobuf v1.34.2 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect lukechampine.com/blake3 v1.3.0 // indirect ) diff --git a/core/src/main/golang/go.sum b/core/src/main/golang/go.sum index 23e05d64..edb7b0ae 100644 --- a/core/src/main/golang/go.sum +++ b/core/src/main/golang/go.sum @@ -267,8 +267,6 @@ google.golang.org/protobuf v1.34.2 h1:6xV6lTsCfpGD21XK49h7MhtcApnLqkfYgPcdHftf6h google.golang.org/protobuf v1.34.2/go.mod h1:qYOHts0dSfpeUzUFpOMr/WGzszTmLH+DiWniOlNbLDw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= -gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/core/src/main/golang/native/config/load.go b/core/src/main/golang/native/config/load.go index 2f05259e..47027652 100644 --- a/core/src/main/golang/native/config/load.go +++ b/core/src/main/golang/native/config/load.go @@ -1,12 +1,12 @@ package config import ( - "io/ioutil" + "os" P "path" "runtime" "strings" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "cfa/native/app" @@ -33,7 +33,7 @@ func logDns(cfg *config.RawConfig) { func UnmarshalAndPatch(profilePath string) (*config.RawConfig, error) { configPath := P.Join(profilePath, "config.yaml") - configData, err := ioutil.ReadFile(configPath) + configData, err := os.ReadFile(configPath) if err != nil { return nil, err } diff --git a/core/src/main/golang/native/config/override.go b/core/src/main/golang/native/config/override.go index c42f5543..cf0ae942 100644 --- a/core/src/main/golang/native/config/override.go +++ b/core/src/main/golang/native/config/override.go @@ -1,7 +1,7 @@ package config import ( - "io/ioutil" + "io" "os" "github.com/metacubex/mihomo/constant" @@ -31,7 +31,7 @@ func ReadOverride(slot OverrideSlot) string { return defaultPersistOverride } - buf, err := ioutil.ReadAll(file) + buf, err := io.ReadAll(file) if err != nil { return defaultPersistOverride }