Skip to content

Commit

Permalink
libnetwork: replace BurntSushi/toml with pelletier/go-toml
Browse files Browse the repository at this point in the history
The BurntSushi project is no longer maintained, and the container ecosystem
is moving to use the pelletier/go-toml project instead.

This patch moves libnetwork to use the pelletier/go-toml library, to reduce
our dependency tree and use the same library in all places.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
  • Loading branch information
thaJeztah committed Jun 4, 2021
1 parent e27beeb commit a7ecbd4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
8 changes: 6 additions & 2 deletions libnetwork/cmd/dnet/dnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import (
"syscall"
"time"

"github.com/BurntSushi/toml"
"github.com/docker/docker/api/types/network"
"github.com/docker/docker/libnetwork"
"github.com/docker/docker/libnetwork/api"
Expand All @@ -35,6 +34,7 @@ import (
"github.com/docker/docker/pkg/reexec"
"github.com/gorilla/mux"
"github.com/moby/term"
"github.com/pelletier/go-toml"
"github.com/sirupsen/logrus"
"github.com/urfave/cli"
)
Expand Down Expand Up @@ -70,7 +70,11 @@ func main() {
func (d *dnetConnection) parseOrchestrationConfig(tomlCfgFile string) error {
dummy := &dnetConnection{}

if _, err := toml.DecodeFile(tomlCfgFile, dummy); err != nil {
data, err := ioutil.ReadFile(tomlCfgFile)
if err != nil {
return err
}
if err := toml.Unmarshal(data, dummy); err != nil {
return err
}

Expand Down
10 changes: 7 additions & 3 deletions libnetwork/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package config

import (
"fmt"
"io/ioutil"
"strings"

"github.com/BurntSushi/toml"
"github.com/docker/docker/libnetwork/cluster"
"github.com/docker/docker/libnetwork/datastore"
"github.com/docker/docker/libnetwork/ipamutils"
Expand All @@ -15,6 +15,7 @@ import (
"github.com/docker/docker/pkg/plugingetter"
"github.com/docker/go-connections/tlsconfig"
"github.com/docker/libkv/store"
"github.com/pelletier/go-toml"
"github.com/sirupsen/logrus"
)

Expand Down Expand Up @@ -70,8 +71,11 @@ func ParseConfig(tomlCfgFile string) (*Config, error) {
cfg := &Config{
Scopes: map[string]*datastore.ScopeCfg{},
}

if _, err := toml.DecodeFile(tomlCfgFile, cfg); err != nil {
data, err := ioutil.ReadFile(tomlCfgFile)
if err != nil {
return nil, err
}
if err := toml.Unmarshal(data, cfg); err != nil {
return nil, err
}

Expand Down

0 comments on commit a7ecbd4

Please sign in to comment.