From 994443c0fb3ae70d3d9d5e2b9e15c13bf6659835 Mon Sep 17 00:00:00 2001 From: Sergei Trofimov Date: Thu, 29 Sep 2022 11:05:48 +0100 Subject: [PATCH] Switch to forked viper Viper currently has a bug where defaults do not get properly propagated when extracting a configuration sub-tree. See https://github.com/spf13/viper/issues/747 A pull request has been opened with a potential fix: https://github.com/spf13/viper/pull/1439 Until the fix (or some alternative) gets merged, switch to using the forked version. --- go.mod | 2 +- go.sum | 4 ++-- kvstore/ikvstore.go | 2 +- kvstore/kvstore.go | 2 +- kvstore/kvstore_test.go | 2 +- kvstore/memory.go | 2 +- kvstore/sql.go | 2 +- kvstore/sql_test.go | 2 +- policy/agent.go | 2 +- policy/agent_test.go | 2 +- policy/iagent.go | 2 +- policy/ibackend.go | 2 +- policy/mocks/mock_ibackend.go | 2 +- policy/opa.go | 2 +- policy/store.go | 2 +- policy/store_test.go | 2 +- provisioning/cmd/main.go | 2 +- verification/cmd/main.go | 2 +- verification/verifier/verifier.go | 2 +- vts/cmd/main.go | 2 +- vts/pluginmanager/pluginmanager_goplugin.go | 2 +- vts/policymanager/mocks/iagent.go | 2 +- vts/policymanager/mocks/ibackend.go | 2 +- vts/policymanager/mocks/ikvstore.go | 2 +- vts/policymanager/policymanager.go | 2 +- vts/policymanager/policymanager_test.go | 2 +- vts/trustedservices/trustedservices_grpc.go | 2 +- vtsclient/vtsclient_grpc.go | 2 +- 28 files changed, 29 insertions(+), 29 deletions(-) diff --git a/go.mod b/go.mod index 1de4e6aa..acaf2f10 100644 --- a/go.mod +++ b/go.mod @@ -15,8 +15,8 @@ require ( github.com/mattn/go-sqlite3 v1.14.14 github.com/moogar0880/problems v0.1.1 github.com/open-policy-agent/opa v0.43.1 + github.com/setrofim/viper v0.0.0-20220928174525-50d48fb2c36f github.com/spf13/cobra v1.5.0 - github.com/spf13/viper v1.13.0 github.com/stretchr/testify v1.8.0 github.com/veraison/corim v0.0.0-20220801100627-a48aacbd333c github.com/veraison/dice v0.0.1 diff --git a/go.sum b/go.sum index 8dafda6c..d090f709 100644 --- a/go.sum +++ b/go.sum @@ -957,6 +957,8 @@ github.com/seccomp/libseccomp-golang v0.9.1/go.mod h1:GbW5+tmTXfcxTToHLXlScSlAvW github.com/seccomp/libseccomp-golang v0.9.2-0.20210429002308-3879420cc921/go.mod h1:JA8cRccbGaA1s33RQf7Y1+q9gHmZX1yB/z9WDN1C6fg= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/setrofim/viper v0.0.0-20220928174525-50d48fb2c36f h1:rkZ6LCbEONoUp/x41dXG10MKEotrgP5tUkJqP+TZTuw= +github.com/setrofim/viper v0.0.0-20220928174525-50d48fb2c36f/go.mod h1:vMrVjiy4fuGY9YEdvIPXTvVLCyUzE8x3LzjRCjYV5EA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.0.4-0.20170822132746-89742aefa4b2/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= github.com/sirupsen/logrus v1.0.6/go.mod h1:pMByvHTf9Beacp5x1UXfOR9xyW/9antXMhjMPG0dEzc= @@ -1008,8 +1010,6 @@ github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/y github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/spf13/viper v1.8.1/go.mod h1:o0Pch8wJ9BVSWGQMbra6iw0oQ5oktSIBaujf1rJH9Ns= github.com/spf13/viper v1.9.0/go.mod h1:+i6ajR7OX2XaiBkrcZJFK21htRk7eDeLg7+O6bhUPP4= -github.com/spf13/viper v1.13.0 h1:BWSJ/M+f+3nmdz9bxB+bWX28kkALN2ok11D0rSo8EJU= -github.com/spf13/viper v1.13.0/go.mod h1:Icm2xNL3/8uyh/wFuB1jI7TiTNKp8632Nwegu+zgdYw= github.com/stefanberger/go-pkcs11uri v0.0.0-20201008174630-78d3cae3a980/go.mod h1:AO3tvPzVZ/ayst6UlUKUv6rcPQInYe3IknH3jYhAKu8= github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/stretchr/objx v0.0.0-20180129172003-8a3f7159479f/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/kvstore/ikvstore.go b/kvstore/ikvstore.go index b34402be..dde73382 100644 --- a/kvstore/ikvstore.go +++ b/kvstore/ikvstore.go @@ -2,7 +2,7 @@ // SPDX-License-Identifier: Apache-2.0 package kvstore -import "github.com/spf13/viper" +import "github.com/setrofim/viper" // IKVStore is the interface to a key-value store. Keys and values are both // strings. A key can be associated with multiple values. diff --git a/kvstore/kvstore.go b/kvstore/kvstore.go index b15be4de..2d4b6e48 100644 --- a/kvstore/kvstore.go +++ b/kvstore/kvstore.go @@ -6,7 +6,7 @@ import ( "errors" "fmt" - "github.com/spf13/viper" + "github.com/setrofim/viper" ) func New(v *viper.Viper) (IKVStore, error) { diff --git a/kvstore/kvstore_test.go b/kvstore/kvstore_test.go index 61e55387..c598d0ee 100644 --- a/kvstore/kvstore_test.go +++ b/kvstore/kvstore_test.go @@ -5,7 +5,7 @@ package kvstore import ( "testing" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/stretchr/testify/assert" ) diff --git a/kvstore/memory.go b/kvstore/memory.go index 1bd1d09f..4f44a0c8 100644 --- a/kvstore/memory.go +++ b/kvstore/memory.go @@ -10,7 +10,7 @@ import ( "sync" "text/tabwriter" - "github.com/spf13/viper" + "github.com/setrofim/viper" ) var ( diff --git a/kvstore/sql.go b/kvstore/sql.go index 6c8b972e..4e7ecea9 100644 --- a/kvstore/sql.go +++ b/kvstore/sql.go @@ -8,7 +8,7 @@ import ( "fmt" "regexp" - "github.com/spf13/viper" + "github.com/setrofim/viper" ) var ( diff --git a/kvstore/sql_test.go b/kvstore/sql_test.go index 82ae49cb..33174860 100644 --- a/kvstore/sql_test.go +++ b/kvstore/sql_test.go @@ -11,7 +11,7 @@ import ( sqlmock "github.com/DATA-DOG/go-sqlmock" _ "github.com/mattn/go-sqlite3" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/policy/agent.go b/policy/agent.go index 8ab0ddbc..07cd94e6 100644 --- a/policy/agent.go +++ b/policy/agent.go @@ -7,7 +7,7 @@ import ( "encoding/json" "fmt" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/veraison/services/proto" ) diff --git a/policy/agent_test.go b/policy/agent_test.go index de2df311..9fd88cdf 100644 --- a/policy/agent_test.go +++ b/policy/agent_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" mock_deps "github.com/veraison/services/policy/mocks" diff --git a/policy/iagent.go b/policy/iagent.go index 15a8e56f..0217aa27 100644 --- a/policy/iagent.go +++ b/policy/iagent.go @@ -3,7 +3,7 @@ package policy import ( "context" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/veraison/services/proto" ) diff --git a/policy/ibackend.go b/policy/ibackend.go index 4d969e0f..e8153903 100644 --- a/policy/ibackend.go +++ b/policy/ibackend.go @@ -3,7 +3,7 @@ package policy import ( "context" - "github.com/spf13/viper" + "github.com/setrofim/viper" ) type IBackend interface { diff --git a/policy/mocks/mock_ibackend.go b/policy/mocks/mock_ibackend.go index a6d65dd4..9dd7b508 100644 --- a/policy/mocks/mock_ibackend.go +++ b/policy/mocks/mock_ibackend.go @@ -9,7 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - viper "github.com/spf13/viper" + viper "github.com/setrofim/viper" ) // MockIBackend is a mock of IBackend interface. diff --git a/policy/opa.go b/policy/opa.go index 3408490e..477b91f6 100644 --- a/policy/opa.go +++ b/policy/opa.go @@ -11,7 +11,7 @@ import ( "log" "github.com/open-policy-agent/opa/rego" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/veraison/services/proto" ) diff --git a/policy/store.go b/policy/store.go index 51480090..2c17149c 100644 --- a/policy/store.go +++ b/policy/store.go @@ -7,7 +7,7 @@ import ( "errors" "fmt" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/veraison/services/kvstore" ) diff --git a/policy/store_test.go b/policy/store_test.go index d7ae391a..14ba41ab 100644 --- a/policy/store_test.go +++ b/policy/store_test.go @@ -5,7 +5,7 @@ package policy import ( "testing" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" ) diff --git a/provisioning/cmd/main.go b/provisioning/cmd/main.go index 692ed697..011573cc 100644 --- a/provisioning/cmd/main.go +++ b/provisioning/cmd/main.go @@ -10,7 +10,7 @@ import ( "os/signal" "syscall" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/veraison/services/provisioning/api" "github.com/veraison/services/provisioning/decoder" "github.com/veraison/services/vtsclient" diff --git a/verification/cmd/main.go b/verification/cmd/main.go index 5bca0fb1..3c30b0b3 100644 --- a/verification/cmd/main.go +++ b/verification/cmd/main.go @@ -3,7 +3,7 @@ package main import ( "log" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/veraison/services/verification/api" "github.com/veraison/services/verification/sessionmanager" "github.com/veraison/services/verification/verifier" diff --git a/verification/verifier/verifier.go b/verification/verifier/verifier.go index 3f5d2001..a72dc575 100644 --- a/verification/verifier/verifier.go +++ b/verification/verifier/verifier.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/veraison/services/proto" "github.com/veraison/services/vtsclient" "google.golang.org/protobuf/types/known/emptypb" diff --git a/vts/cmd/main.go b/vts/cmd/main.go index 5af70165..c8979744 100644 --- a/vts/cmd/main.go +++ b/vts/cmd/main.go @@ -9,7 +9,7 @@ import ( "syscall" _ "github.com/mattn/go-sqlite3" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/veraison/services/kvstore" "github.com/veraison/services/policy" diff --git a/vts/pluginmanager/pluginmanager_goplugin.go b/vts/pluginmanager/pluginmanager_goplugin.go index 73a28557..b74b2dbb 100644 --- a/vts/pluginmanager/pluginmanager_goplugin.go +++ b/vts/pluginmanager/pluginmanager_goplugin.go @@ -8,7 +8,7 @@ import ( "log" "github.com/hashicorp/go-plugin" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/veraison/services/proto" "github.com/veraison/services/scheme" ) diff --git a/vts/policymanager/mocks/iagent.go b/vts/policymanager/mocks/iagent.go index 6cb0f244..00cdbbb3 100644 --- a/vts/policymanager/mocks/iagent.go +++ b/vts/policymanager/mocks/iagent.go @@ -9,7 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - viper "github.com/spf13/viper" + viper "github.com/setrofim/viper" policy "github.com/veraison/services/policy" proto "github.com/veraison/services/proto" ) diff --git a/vts/policymanager/mocks/ibackend.go b/vts/policymanager/mocks/ibackend.go index 7ade4588..4f8a9289 100644 --- a/vts/policymanager/mocks/ibackend.go +++ b/vts/policymanager/mocks/ibackend.go @@ -9,7 +9,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - viper "github.com/spf13/viper" + viper "github.com/setrofim/viper" ) // MockIBackend is a mock of IBackend interface. diff --git a/vts/policymanager/mocks/ikvstore.go b/vts/policymanager/mocks/ikvstore.go index 899b5630..bb8a2fb5 100644 --- a/vts/policymanager/mocks/ikvstore.go +++ b/vts/policymanager/mocks/ikvstore.go @@ -8,7 +8,7 @@ import ( reflect "reflect" gomock "github.com/golang/mock/gomock" - viper "github.com/spf13/viper" + viper "github.com/setrofim/viper" ) // MockIKVStore is a mock of IKVStore interface. diff --git a/vts/policymanager/policymanager.go b/vts/policymanager/policymanager.go index 5060b701..5b608e9c 100644 --- a/vts/policymanager/policymanager.go +++ b/vts/policymanager/policymanager.go @@ -7,7 +7,7 @@ import ( "errors" "fmt" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/veraison/services/policy" "github.com/veraison/services/proto" ) diff --git a/vts/policymanager/policymanager_test.go b/vts/policymanager/policymanager_test.go index 73a40bf7..d22bb5e2 100644 --- a/vts/policymanager/policymanager_test.go +++ b/vts/policymanager/policymanager_test.go @@ -8,7 +8,7 @@ import ( "testing" "github.com/golang/mock/gomock" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" "github.com/veraison/services/kvstore" diff --git a/vts/trustedservices/trustedservices_grpc.go b/vts/trustedservices/trustedservices_grpc.go index 3b056e78..6c1bf1e3 100644 --- a/vts/trustedservices/trustedservices_grpc.go +++ b/vts/trustedservices/trustedservices_grpc.go @@ -10,7 +10,7 @@ import ( "log" "net" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/veraison/services/kvstore" "github.com/veraison/services/proto" "github.com/veraison/services/scheme" diff --git a/vtsclient/vtsclient_grpc.go b/vtsclient/vtsclient_grpc.go index 360bbe3f..4fa51727 100644 --- a/vtsclient/vtsclient_grpc.go +++ b/vtsclient/vtsclient_grpc.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - "github.com/spf13/viper" + "github.com/setrofim/viper" "github.com/veraison/services/proto" "github.com/veraison/services/vts/trustedservices" "google.golang.org/grpc"