From 71eb5eebf2bece1068e6716ae3e282b06e2fd7eb Mon Sep 17 00:00:00 2001 From: wangshihui Date: Wed, 25 Aug 2021 12:33:03 +0800 Subject: [PATCH 1/2] fix(meta): device yaml marshal to Json error when add some complex vaules to the attributes of deviceResources in the device profile, error happens. use gopkg.in/yaml.v3 instead of gopkg.in/yaml.v2 Fixes: #3682 Signed-off-by: wangshihui --- go.mod | 1 + internal/io/reader.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index d02e9d640a..32a8ab7a3b 100644 --- a/go.mod +++ b/go.mod @@ -18,6 +18,7 @@ require ( golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 gopkg.in/eapache/queue.v1 v1.1.0 gopkg.in/yaml.v2 v2.4.0 + gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b ) go 1.16 diff --git a/internal/io/reader.go b/internal/io/reader.go index 71f8bbd663..981cad3f0c 100644 --- a/internal/io/reader.go +++ b/internal/io/reader.go @@ -15,7 +15,7 @@ import ( "github.com/edgexfoundry/go-mod-core-contracts/v2/errors" "github.com/fxamacker/cbor/v2" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" ) type DtoReader interface { From 99d79dac044befae558f66d4c8d751cd8b6be238 Mon Sep 17 00:00:00 2001 From: wangshihui Date: Wed, 25 Aug 2021 14:41:58 +0800 Subject: [PATCH 2/2] fix(meta): device yaml marshal to Json error remove gopkg.in/yaml.v2 use v3 instead Fixes: #3682 Signed-off-by: wangshihui --- Attribution.txt | 3 --- go.mod | 1 - internal/core/metadata/controller/http/deviceprofile_test.go | 2 +- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/Attribution.txt b/Attribution.txt index 77f707df7e..434d962b76 100644 --- a/Attribution.txt +++ b/Attribution.txt @@ -149,9 +149,6 @@ https://github.com/x448/float16/blob/master/LICENSE golang.org/x/net (Unspecified) https://github.com/golang/net https://github.com/golang/net/blob/master/LICENSE -gopkg.in/yaml.v2 (Apache 2.0) https://github.com/go-yaml/yaml/ -https://github.com/go-yaml/yaml/blob/v2.2.2/LICENSE - gopkg.in/yaml.v3 (MIT) https://github.com/go-yaml/yaml/ https://github.com/go-yaml/yaml/blob/v3/LICENSE diff --git a/go.mod b/go.mod index 32a8ab7a3b..3474221010 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,6 @@ require ( github.com/stretchr/testify v1.7.0 golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97 gopkg.in/eapache/queue.v1 v1.1.0 - gopkg.in/yaml.v2 v2.4.0 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b ) diff --git a/internal/core/metadata/controller/http/deviceprofile_test.go b/internal/core/metadata/controller/http/deviceprofile_test.go index cfda8ea448..aeb4f6dfae 100644 --- a/internal/core/metadata/controller/http/deviceprofile_test.go +++ b/internal/core/metadata/controller/http/deviceprofile_test.go @@ -9,7 +9,7 @@ import ( "bytes" "encoding/json" "fmt" - "gopkg.in/yaml.v2" + "gopkg.in/yaml.v3" "mime/multipart" "net/http" "net/http/httptest"