зеркало из https://github.com/getsops/sops.git
Use 4 indents for yaml
This commit is contained in:
Родитель
52f7881230
Коммит
29c6d46f8d
|
@ -2,11 +2,12 @@ package yaml
|
|||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/autrilla/yaml"
|
||||
"io/ioutil"
|
||||
"os"
|
||||
"path"
|
||||
"regexp"
|
||||
|
||||
"go.mozilla.org/yaml.v2"
|
||||
)
|
||||
|
||||
type fileSystem interface {
|
||||
|
|
|
@ -99,7 +99,7 @@ func (store Store) treeBranchToYamlMap(in sops.TreeBranch) yaml.MapSlice {
|
|||
// Marshal takes a sops tree branch and marshals it into a yaml document
|
||||
func (store Store) Marshal(tree sops.TreeBranch) ([]byte, error) {
|
||||
yamlMap := store.treeBranchToYamlMap(tree)
|
||||
out, err := yaml.Marshal(yamlMap)
|
||||
out, err := (&yaml.YAMLMarshaler{Indent: 4}).Marshal(yamlMap)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Error marshaling to yaml: %s", err)
|
||||
}
|
||||
|
@ -110,7 +110,7 @@ func (store Store) Marshal(tree sops.TreeBranch) ([]byte, error) {
|
|||
func (store Store) MarshalWithMetadata(tree sops.TreeBranch, metadata sops.Metadata) ([]byte, error) {
|
||||
yamlMap := store.treeBranchToYamlMap(tree)
|
||||
yamlMap = append(yamlMap, yaml.MapItem{Key: "sops", Value: metadata.ToMap()})
|
||||
out, err := yaml.Marshal(yamlMap)
|
||||
out, err := (&yaml.YAMLMarshaler{Indent: 4}).Marshal(yamlMap)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("Error marshaling to yaml: %s", err)
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче