Migrate current TOML code to github.com/pelletier/go-toml
Signed-off-by: Maksym Pavlenko <pavlenko.maksym@gmail.com>
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user