diff -r 8f478162d991 -r 05c40b36d3b2 vendor/github.com/spf13/viper/internal/encoding/toml/codec.go --- a/vendor/github.com/spf13/viper/internal/encoding/toml/codec.go Thu Sep 22 16:37:07 2022 +0200 +++ b/vendor/github.com/spf13/viper/internal/encoding/toml/codec.go Sat Feb 04 12:58:35 2023 +0100 @@ -1,39 +1,16 @@ -//go:build viper_toml1 -// +build viper_toml1 - package toml import ( - "github.com/pelletier/go-toml" + "github.com/pelletier/go-toml/v2" ) // Codec implements the encoding.Encoder and encoding.Decoder interfaces for TOML encoding. type Codec struct{} func (Codec) Encode(v map[string]interface{}) ([]byte, error) { - t, err := toml.TreeFromMap(v) - if err != nil { - return nil, err - } - - s, err := t.ToTomlString() - if err != nil { - return nil, err - } - - return []byte(s), nil + return toml.Marshal(v) } func (Codec) Decode(b []byte, v map[string]interface{}) error { - tree, err := toml.LoadBytes(b) - if err != nil { - return err - } - - tmap := tree.ToMap() - for key, value := range tmap { - v[key] = value - } - - return nil + return toml.Unmarshal(b, &v) }