Skip to content

Commit

Permalink
Swap yaml library to sigs.k8s.io/yaml
Browse files Browse the repository at this point in the history
This module is supported and also gives access to easy
yaml > json conversion and back which will be needed in
the future
  • Loading branch information
dramich committed Sep 15, 2023
1 parent eee8b34 commit 61eb0d4
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 10 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
github.com/xeipuuv/gojsonschema v1.2.0
golang.org/x/mod v0.9.0
golang.org/x/text v0.8.0
gopkg.in/yaml.v3 v3.0.1
sigs.k8s.io/yaml v1.3.0
)

require (
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -816,3 +816,5 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8
rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4=
rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0=
rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA=
sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo=
sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8=
2 changes: 1 addition & 1 deletion pkg/bundle/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

"github.com/massdriver-cloud/mass/pkg/restclient"
"github.com/spf13/afero"
"gopkg.in/yaml.v2"
"sigs.k8s.io/yaml"
)

type Handler struct {
Expand Down
2 changes: 1 addition & 1 deletion pkg/commands/build_bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/massdriver-cloud/mass/pkg/mockfilesystem"
"github.com/massdriver-cloud/mass/pkg/restclient"
"github.com/spf13/afero"
"gopkg.in/yaml.v3"
"sigs.k8s.io/yaml"
)

var expectedSchemaContents = map[string][]byte{
Expand Down
13 changes: 7 additions & 6 deletions pkg/commands/generate_new_bundle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,12 @@ import (
"reflect"
"testing"

"github.com/massdriver-cloud/mass/pkg/bundle"
"github.com/massdriver-cloud/mass/pkg/commands"
"github.com/massdriver-cloud/mass/pkg/mockfilesystem"
"github.com/massdriver-cloud/mass/pkg/templatecache"
"github.com/spf13/afero"
"gopkg.in/yaml.v3"
"sigs.k8s.io/yaml"
)

func TestCopyFilesFromTemplateToCurrentDirectory(t *testing.T) {
Expand Down Expand Up @@ -116,7 +117,7 @@ func TestTemplateRender(t *testing.T) {

checkErr(err, t)

got := make(map[string]interface{})
got := &bundle.Bundle{}

err = yaml.Unmarshal(renderedTemplate, got)

Expand All @@ -134,12 +135,12 @@ func TestTemplateRender(t *testing.T) {
"required": []interface{}{"aws_authentication", "dynamo"},
}

if got["name"] != templateData.Name {
t.Errorf("Expected rendered template's name field to be %s but got %s", templateData.Name, got["name"])
if got.Name != templateData.Name {
t.Errorf("Expected rendered template's name field to be %s but got %s", templateData.Name, got.Name)
}

if !reflect.DeepEqual(got["connections"], wantConnections) {
t.Errorf("Expected rendered template's connections field to be %v but got %v", wantConnections, got["connections"])
if !reflect.DeepEqual(got.Connections, wantConnections) {
t.Errorf("Expected rendered template's connections field to be %v but got %v", wantConnections, got.Connections)
}
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/files/files.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"path/filepath"

"github.com/BurntSushi/toml"
"gopkg.in/yaml.v3"
"sigs.k8s.io/yaml"
)

const UserRW = 0600
Expand Down

0 comments on commit 61eb0d4

Please sign in to comment.