Merge pull request #5278 from mxpv/toml

Migrate TOML to github.com/pelletier/go-toml
This commit is contained in:
Derek McGowan
2021-04-01 21:24:52 -07:00
committed by GitHub
59 changed files with 5433 additions and 3610 deletions

View File

@@ -22,9 +22,9 @@ import (
"fmt"
"os"
"github.com/BurntSushi/toml"
"github.com/docker/go-units"
"github.com/hashicorp/go-multierror"
"github.com/pelletier/go-toml"
"github.com/pkg/errors"
)
@@ -56,8 +56,13 @@ func LoadConfig(path string) (*Config, error) {
}
config := Config{}
if _, err := toml.DecodeFile(path, &config); err != nil {
return nil, errors.Wrapf(err, "failed to unmarshal data at '%s'", path)
file, err := toml.LoadFile(path)
if err != nil {
return nil, errors.Wrapf(err, "failed to open devmapepr TOML: %s", path)
}
if err := file.Unmarshal(&config); err != nil {
return nil, errors.Wrap(err, "failed to unmarshal devmapper TOML")
}
if err := config.parse(); err != nil {

View File

@@ -23,8 +23,8 @@ import (
"os"
"testing"
"github.com/BurntSushi/toml"
"github.com/hashicorp/go-multierror"
"github.com/pelletier/go-toml"
"gotest.tools/v3/assert"
is "gotest.tools/v3/assert/cmp"
)