summaryrefslogtreecommitdiff
path: root/vendor/github.com/spf13/viper/internal/encoding/toml/codec.go
diff options
context:
space:
mode:
authorLibravatar dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>2023-01-23 10:24:00 +0100
committerLibravatar GitHub <noreply@github.com>2023-01-23 10:24:00 +0100
commit98a09b563318b751bb01d7cbc3af5cfc4601c9bd (patch)
tree63ed55523830a4c0a99d597b487cff22e0d20eff /vendor/github.com/spf13/viper/internal/encoding/toml/codec.go
parent[chore]: Bump github.com/abema/go-mp4 from 0.9.0 to 0.10.0 (#1374) (diff)
downloadgotosocial-98a09b563318b751bb01d7cbc3af5cfc4601c9bd.tar.xz
[chore]: Bump github.com/spf13/viper from 1.14.0 to 1.15.0 (#1375)
Bumps [github.com/spf13/viper](https://github.com/spf13/viper) from 1.14.0 to 1.15.0. - [Release notes](https://github.com/spf13/viper/releases) - [Commits](https://github.com/spf13/viper/compare/v1.14.0...v1.15.0) --- updated-dependencies: - dependency-name: github.com/spf13/viper dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Diffstat (limited to 'vendor/github.com/spf13/viper/internal/encoding/toml/codec.go')
-rw-r--r--vendor/github.com/spf13/viper/internal/encoding/toml/codec.go29
1 files changed, 3 insertions, 26 deletions
diff --git a/vendor/github.com/spf13/viper/internal/encoding/toml/codec.go b/vendor/github.com/spf13/viper/internal/encoding/toml/codec.go
index 45fddc8b5..a993c5994 100644
--- a/vendor/github.com/spf13/viper/internal/encoding/toml/codec.go
+++ b/vendor/github.com/spf13/viper/internal/encoding/toml/codec.go
@@ -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)
}