common/helpers: switch to a blessed fork of mapstructure

This commit is contained in:
Vincent Bernat
2025-02-15 14:25:43 +01:00
parent 415ca6659c
commit e08331a286
16 changed files with 20 additions and 20 deletions

View File

@@ -18,7 +18,7 @@ import (
"github.com/gin-gonic/gin"
"github.com/go-playground/validator/v10"
"github.com/mitchellh/mapstructure"
"github.com/go-viper/mapstructure/v2"
"akvorado/common/helpers/yaml"

View File

@@ -8,7 +8,7 @@ import (
"reflect"
"github.com/gin-gonic/gin"
"github.com/mitchellh/mapstructure"
"github.com/go-viper/mapstructure/v2"
"github.com/spf13/cobra"
"akvorado/common/daemon"

View File

@@ -8,7 +8,7 @@ import (
"fmt"
"reflect"
"github.com/mitchellh/mapstructure"
"github.com/go-viper/mapstructure/v2"
"github.com/spf13/cobra"
"akvorado/common/clickhousedb"

View File

@@ -10,7 +10,7 @@ import (
"strings"
"github.com/gin-gonic/gin"
"github.com/mitchellh/mapstructure"
"github.com/go-viper/mapstructure/v2"
)
var mapstructureUnmarshallerHookFuncs = []mapstructure.DecodeHookFunc{}

View File

@@ -10,7 +10,7 @@ import (
"testing"
"github.com/gin-gonic/gin"
"github.com/mitchellh/mapstructure"
"github.com/go-viper/mapstructure/v2"
)
func TestMapStructureMatchName(t *testing.T) {
@@ -58,10 +58,10 @@ func TestProtectedDecodeHook(t *testing.T) {
} else {
got := strings.Split(err.Error(), "\n")
expected := []string{
`2 error(s) decoding:`,
`decoding failed due to the following error(s):`,
``,
`* error decoding 'A': internal error while parsing: noooo`,
`* error decoding 'B': internal error while parsing: noooo`,
`error decoding 'A': internal error while parsing: noooo`,
`error decoding 'B': internal error while parsing: noooo`,
}
if diff := Diff(got, expected); diff != "" {
t.Fatalf("Decode() error:\n%s", diff)

View File

@@ -12,9 +12,9 @@ import (
"strings"
"github.com/gin-gonic/gin"
"github.com/go-viper/mapstructure/v2"
"github.com/kentik/patricia"
tree "github.com/kentik/patricia/generics_tree"
"github.com/mitchellh/mapstructure"
)
// SubnetMap maps subnets to values and allow to lookup by IP address.

View File

@@ -8,7 +8,7 @@ import (
"testing"
"github.com/gin-gonic/gin"
"github.com/mitchellh/mapstructure"
"github.com/go-viper/mapstructure/v2"
"akvorado/common/helpers/yaml"

View File

@@ -9,7 +9,7 @@ import (
"fmt"
"testing"
"github.com/mitchellh/mapstructure"
"github.com/go-viper/mapstructure/v2"
"akvorado/common/helpers/yaml"
)

View File

@@ -14,8 +14,8 @@ import (
"time"
"github.com/cenkalti/backoff/v4"
"github.com/go-viper/mapstructure/v2"
"github.com/itchyny/gojq"
"github.com/mitchellh/mapstructure"
"gopkg.in/tomb.v2"
"akvorado/common/reporter"

2
go.mod
View File

@@ -24,6 +24,7 @@ require (
github.com/glebarez/sqlite v1.11.0
github.com/go-playground/validator/v10 v10.20.0
github.com/go-redis/redis/v8 v8.11.5
github.com/go-viper/mapstructure/v2 v2.2.1
github.com/google/gopacket v1.1.19
github.com/gosnmp/gosnmp v1.38.0
github.com/grpc-ecosystem/go-grpc-middleware/providers/prometheus v1.0.1
@@ -34,7 +35,6 @@ require (
github.com/kylelemons/godebug v1.1.0
github.com/mattn/go-isatty v0.0.20
github.com/mgechev/revive v1.6.0
github.com/mitchellh/mapstructure v1.5.0
github.com/mna/pigeon v1.3.0
github.com/netsampler/goflow2/v2 v2.2.1
github.com/openconfig/gnmi v0.12.0

4
go.sum
View File

@@ -156,6 +156,8 @@ github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/go-test/deep v1.1.0 h1:WOcxcdHcvdgThNXjw0t76K42FXTU7HpNQWHpA2HHNlg=
github.com/go-test/deep v1.1.0/go.mod h1:5C2ZWiW0ErCdrYzpqxLbTX7MG14M9iiw8DgHncVwcsE=
github.com/go-viper/mapstructure/v2 v2.2.1 h1:ZAaOCxANMuZx5RCeg0mBdEZk7DZasvvZIxtHqx8aGss=
github.com/go-viper/mapstructure/v2 v2.2.1/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM=
github.com/goccy/go-json v0.10.2 h1:CrxCmQqYDkv1z7lO7Wbh2HN93uovUHgrECaO5ZrCXAU=
github.com/goccy/go-json v0.10.2/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
@@ -306,8 +308,6 @@ github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517 h1:zpIH83+oKzcpryru8c
github.com/mgechev/dots v0.0.0-20210922191527-e955255bf517/go.mod h1:KQ7+USdGKfpPjXk4Ga+5XxQM4Lm4e3gAogrreFAYpOg=
github.com/mgechev/revive v1.6.0 h1:NsdaDzYcWZd3ikrWbdbFsvk+DvEAmP6A21LAdZEomZg=
github.com/mgechev/revive v1.6.0/go.mod h1:YpafN9JKjfKxG/UDGUHU1kPJKalHx7fHIgclT04SjBs=
github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY=
github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo=
github.com/mna/pigeon v1.3.0 h1:/3fzVrl1C2RK3x04tyL+ribn+3S3VSEFFbCFLmRPAoc=
github.com/mna/pigeon v1.3.0/go.mod h1:SKQNHonx2q9U2QSSoPtMigExj+vQ1mOpL7UVFQF/IA0=
github.com/moby/docker-image-spec v1.3.1 h1:jMKff3w6PgbfSa69GfNg+zN/XLhfXJGnEx3Nl2EsFP0=

View File

@@ -11,7 +11,7 @@ import (
"akvorado/common/helpers"
"github.com/mitchellh/mapstructure"
"github.com/go-viper/mapstructure/v2"
)
// Configuration describes the configuration for the core component.

View File

@@ -11,7 +11,7 @@ import (
"github.com/IBM/sarama"
"github.com/gin-gonic/gin"
"github.com/mitchellh/mapstructure"
"github.com/go-viper/mapstructure/v2"
"akvorado/common/daemon"
"akvorado/common/helpers"

View File

@@ -11,7 +11,7 @@ import (
"akvorado/common/helpers"
"akvorado/inlet/metadata/provider"
"github.com/mitchellh/mapstructure"
"github.com/go-viper/mapstructure/v2"
)
// Configuration describes the configuration for the gNMI client

View File

@@ -9,8 +9,8 @@ import (
"time"
"github.com/gin-gonic/gin"
"github.com/go-viper/mapstructure/v2"
"github.com/gosnmp/gosnmp"
"github.com/mitchellh/mapstructure"
"akvorado/common/helpers"
"akvorado/inlet/metadata/provider"

View File

@@ -13,7 +13,7 @@ import (
"akvorado/common/helpers"
"akvorado/common/kafka"
"github.com/mitchellh/mapstructure"
"github.com/go-viper/mapstructure/v2"
)
// Configuration describes the configuration for the ClickHouse configurator.