From 23f6e182ed308f004fd8105a4f866ebe4766ed4c Mon Sep 17 00:00:00 2001 From: thomasbkd Date: Thu, 20 Mar 2025 16:49:04 +0100 Subject: [PATCH] Migrating mapstructure repo from mitchellh to go-viper --- certificates/auth/models.go | 2 +- certificates/ca/models.go | 2 +- certificates/certs/models.go | 2 +- certificates/cipher/models.go | 2 +- certificates/curves/models.go | 2 +- certificates/tlsversion/models.go | 2 +- duration/model.go | 2 +- file/perm/model.go | 2 +- go.mod | 17 ++++++----------- network/protocol/model.go | 2 +- size/model.go | 2 +- status/control/model.go | 2 +- viper/hook.go | 2 +- viper/interface.go | 2 +- 14 files changed, 19 insertions(+), 24 deletions(-) diff --git a/certificates/auth/models.go b/certificates/auth/models.go index 117c16a..3d349a1 100644 --- a/certificates/auth/models.go +++ b/certificates/auth/models.go @@ -29,7 +29,7 @@ package auth import ( "reflect" - libmap "github.com/mitchellh/mapstructure" + libmap "github.com/go-viper/mapstructure/v2" ) func ViperDecoderHook() libmap.DecodeHookFuncType { diff --git a/certificates/ca/models.go b/certificates/ca/models.go index 5fcfd30..935cbf4 100644 --- a/certificates/ca/models.go +++ b/certificates/ca/models.go @@ -30,7 +30,7 @@ import ( "crypto/x509" "reflect" - libmap "github.com/mitchellh/mapstructure" + libmap "github.com/go-viper/mapstructure/v2" ) type mod struct { diff --git a/certificates/certs/models.go b/certificates/certs/models.go index 9ac2259..2995691 100644 --- a/certificates/certs/models.go +++ b/certificates/certs/models.go @@ -30,7 +30,7 @@ import ( "crypto/tls" "reflect" - libmap "github.com/mitchellh/mapstructure" + libmap "github.com/go-viper/mapstructure/v2" ) type Certif struct { diff --git a/certificates/cipher/models.go b/certificates/cipher/models.go index e2e1f22..f62c4c2 100644 --- a/certificates/cipher/models.go +++ b/certificates/cipher/models.go @@ -29,7 +29,7 @@ package curves import ( "reflect" - libmap "github.com/mitchellh/mapstructure" + libmap "github.com/go-viper/mapstructure/v2" ) func (v Cipher) Check() bool { diff --git a/certificates/curves/models.go b/certificates/curves/models.go index 538e32e..8a5a87a 100644 --- a/certificates/curves/models.go +++ b/certificates/curves/models.go @@ -29,7 +29,7 @@ package curves import ( "reflect" - libmap "github.com/mitchellh/mapstructure" + libmap "github.com/go-viper/mapstructure/v2" ) func (v Curves) Check() bool { diff --git a/certificates/tlsversion/models.go b/certificates/tlsversion/models.go index d0d0527..fe6bd72 100644 --- a/certificates/tlsversion/models.go +++ b/certificates/tlsversion/models.go @@ -29,7 +29,7 @@ package tlsversion import ( "reflect" - libmap "github.com/mitchellh/mapstructure" + libmap "github.com/go-viper/mapstructure/v2" ) func (v Version) Check() bool { diff --git a/duration/model.go b/duration/model.go index 4138a71..43d0282 100644 --- a/duration/model.go +++ b/duration/model.go @@ -28,7 +28,7 @@ package duration import ( "reflect" - libmap "github.com/mitchellh/mapstructure" + libmap "github.com/go-viper/mapstructure/v2" ) func ViperDecoderHook() libmap.DecodeHookFuncType { diff --git a/file/perm/model.go b/file/perm/model.go index 847d3d9..d4a023d 100644 --- a/file/perm/model.go +++ b/file/perm/model.go @@ -30,7 +30,7 @@ package perm import ( "reflect" - libmap "github.com/mitchellh/mapstructure" + libmap "github.com/go-viper/mapstructure/v2" ) func ViperDecoderHook() libmap.DecodeHookFuncType { diff --git a/go.mod b/go.mod index dac11c7..c869c4e 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,8 @@ module github.com/nabbar/golib -go 1.23 +go 1.23.0 -toolchain go1.23.5 +toolchain go1.23.6 require ( github.com/aws/aws-sdk-go v1.55.6 @@ -21,6 +21,7 @@ require ( github.com/gin-gonic/gin v1.10.0 github.com/go-ldap/ldap/v3 v3.4.10 github.com/go-playground/validator/v10 v10.25.0 + github.com/go-viper/mapstructure/v2 v2.2.1 github.com/google/go-github/v33 v33.0.0 github.com/hashicorp/go-hclog v1.6.3 github.com/hashicorp/go-retryablehttp v0.7.7 @@ -30,7 +31,6 @@ require ( github.com/matcornic/hermes/v2 v2.1.0 github.com/mattn/go-colorable v0.1.14 github.com/mitchellh/go-homedir v1.1.0 - github.com/mitchellh/mapstructure v1.5.0 github.com/nats-io/jwt/v2 v2.7.3 github.com/nats-io/nats-server/v2 v2.10.26 github.com/nats-io/nats.go v1.39.1 @@ -44,7 +44,7 @@ require ( github.com/sirupsen/logrus v1.9.3 github.com/spf13/cobra v1.9.1 github.com/spf13/jwalterweatherman v1.1.0 - github.com/spf13/viper v1.19.0 + github.com/spf13/viper v1.20.0 github.com/ugorji/go/codec v1.2.12 github.com/ulikunitz/xz v0.5.12 github.com/vbauerster/mpb/v8 v8.9.3 @@ -117,7 +117,6 @@ require ( github.com/hashicorp/errwrap v1.1.0 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect github.com/hashicorp/go-multierror v1.1.1 // indirect - github.com/hashicorp/hcl v1.0.0 // indirect github.com/huandu/xstrings v1.5.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect @@ -133,7 +132,6 @@ require ( github.com/klauspost/compress v1.18.0 // indirect github.com/klauspost/cpuid/v2 v2.2.10 // indirect github.com/leodido/go-urn v1.4.0 // indirect - github.com/magiconair/properties v1.8.9 // indirect github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect github.com/mattn/go-sqlite3 v1.14.24 // indirect @@ -156,12 +154,11 @@ require ( github.com/prometheus/procfs v0.15.1 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect - github.com/sagikazarmark/locafero v0.7.0 // indirect - github.com/sagikazarmark/slog-shim v0.1.0 // indirect + github.com/sagikazarmark/locafero v0.8.0 // indirect github.com/segmentio/asm v1.2.0 // indirect github.com/shopspring/decimal v1.4.0 // indirect github.com/sourcegraph/conc v0.3.0 // indirect - github.com/spf13/afero v1.12.0 // indirect + github.com/spf13/afero v1.14.0 // indirect github.com/spf13/cast v1.7.1 // indirect github.com/spf13/pflag v1.0.6 // indirect github.com/ssor/bom v0.0.0-20170718123548-6386211fdfcf // indirect @@ -176,10 +173,8 @@ require ( go.uber.org/multierr v1.11.0 // indirect golang.org/x/arch v0.15.0 // indirect golang.org/x/crypto v0.36.0 // indirect - golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect golang.org/x/text v0.23.0 // indirect golang.org/x/time v0.11.0 // indirect golang.org/x/tools v0.31.0 // indirect google.golang.org/protobuf v1.36.5 // indirect - gopkg.in/ini.v1 v1.67.0 // indirect ) diff --git a/network/protocol/model.go b/network/protocol/model.go index dc7d81e..082cee4 100644 --- a/network/protocol/model.go +++ b/network/protocol/model.go @@ -31,7 +31,7 @@ import ( "reflect" "strings" - libmap "github.com/mitchellh/mapstructure" + libmap "github.com/go-viper/mapstructure/v2" ) func (n NetworkProtocol) String() string { diff --git a/size/model.go b/size/model.go index aacec7f..bb9c4d0 100644 --- a/size/model.go +++ b/size/model.go @@ -32,7 +32,7 @@ import ( "math" "reflect" - libmap "github.com/mitchellh/mapstructure" + libmap "github.com/go-viper/mapstructure/v2" ) func (s Size) Code(unit rune) string { diff --git a/status/control/model.go b/status/control/model.go index c242a5d..001dcbd 100644 --- a/status/control/model.go +++ b/status/control/model.go @@ -30,7 +30,7 @@ import ( "reflect" "strings" - libmap "github.com/mitchellh/mapstructure" + libmap "github.com/go-viper/mapstructure/v2" ) func (c Mode) String() string { diff --git a/viper/hook.go b/viper/hook.go index 13b0930..5e9a896 100644 --- a/viper/hook.go +++ b/viper/hook.go @@ -31,7 +31,7 @@ import ( "math" "reflect" - libmap "github.com/mitchellh/mapstructure" + libmap "github.com/go-viper/mapstructure/v2" spfvpr "github.com/spf13/viper" ) diff --git a/viper/interface.go b/viper/interface.go index e1e125b..e38d754 100644 --- a/viper/interface.go +++ b/viper/interface.go @@ -33,7 +33,7 @@ import ( liblog "github.com/nabbar/golib/logger" - libmap "github.com/mitchellh/mapstructure" + libmap "github.com/go-viper/mapstructure/v2" libctx "github.com/nabbar/golib/context" liberr "github.com/nabbar/golib/errors" loglvl "github.com/nabbar/golib/logger/level"