switch to gopkg.in/yaml.v3
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
@ -1,6 +1,7 @@
|
||||
package stack
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
|
||||
"github.com/docker/cli/cli"
|
||||
@ -11,7 +12,7 @@ import (
|
||||
composeLoader "github.com/docker/cli/cli/compose/loader"
|
||||
composetypes "github.com/docker/cli/cli/compose/types"
|
||||
"github.com/spf13/cobra"
|
||||
yaml "gopkg.in/yaml.v2"
|
||||
"gopkg.in/yaml.v3"
|
||||
)
|
||||
|
||||
func newConfigCommand(dockerCli command.Cli) *cobra.Command {
|
||||
@ -54,9 +55,12 @@ func outputConfig(configFiles composetypes.ConfigDetails, skipInterpolation bool
|
||||
return "", err
|
||||
}
|
||||
|
||||
d, err := yaml.Marshal(&config)
|
||||
var buf bytes.Buffer
|
||||
enc := yaml.NewEncoder(&buf)
|
||||
enc.SetIndent(2)
|
||||
err = enc.Encode(&config)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(d), nil
|
||||
return buf.String(), nil
|
||||
}
|
||||
|
||||
@ -45,8 +45,8 @@ services:
|
||||
services:
|
||||
foo:
|
||||
command:
|
||||
- cat
|
||||
- file2.txt
|
||||
- cat
|
||||
- file2.txt
|
||||
image: busybox:1.0
|
||||
`,
|
||||
},
|
||||
@ -69,8 +69,8 @@ services:
|
||||
services:
|
||||
foo:
|
||||
command:
|
||||
- cat
|
||||
- file2.txt
|
||||
- cat
|
||||
- file2.txt
|
||||
image: busybox:${VERSION}
|
||||
`,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user