Skip to content

Commit b82101a

Browse files
committed
update to yaml/v3, replace ioutil.ReadFile with os.ReadFile
1 parent d3e4dc6 commit b82101a

File tree

12 files changed

+21
-22
lines changed

12 files changed

+21
-22
lines changed

fieldpath/fromvalue_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package fieldpath
1919
import (
2020
"testing"
2121

22-
yaml "go.yaml.in/yaml/v2"
22+
yaml "go.yaml.in/yaml/v3"
2323
"sigs.k8s.io/structured-merge-diff/v6/value"
2424
)
2525

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module sigs.k8s.io/structured-merge-diff/v6
33
require (
44
github.com/google/go-cmp v0.5.9
55
github.com/json-iterator/go v1.1.12
6-
go.yaml.in/yaml/v2 v2.4.2
6+
go.yaml.in/yaml/v3 v3.0.4
77
sigs.k8s.io/randfill v0.0.0-20250304075658-069ef1bbf016
88
)
99

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
1616
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
1717
github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q=
1818
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
19-
go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI=
20-
go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU=
19+
go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc=
20+
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
2121
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
2222
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
2323
sigs.k8s.io/randfill v0.0.0-20250304075658-069ef1bbf016 h1:kXv6kKdoEtedwuqMmkqhbkgvYKeycVbC8+iPCP9j5kQ=

internal/cli/main_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package cli
1919
import (
2020
"bytes"
2121
"encoding/json"
22-
"io/ioutil"
22+
"os"
2323
"path/filepath"
2424
"testing"
2525
)
@@ -130,7 +130,7 @@ func (tt *testCase) checkOutput(t *testing.T, got []byte) {
130130
if tt.expectedOutputPath == "" {
131131
return
132132
}
133-
want, err := ioutil.ReadFile(tt.expectedOutputPath)
133+
want, err := os.ReadFile(tt.expectedOutputPath)
134134
if err != nil {
135135
t.Fatalf("couldn't read expected output %q: %v", tt.expectedOutputPath, err)
136136
}

internal/cli/operation.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package cli
1919
import (
2020
"fmt"
2121
"io"
22-
"io/ioutil"
22+
"os"
2323

2424
"sigs.k8s.io/structured-merge-diff/v6/typed"
2525
"sigs.k8s.io/structured-merge-diff/v6/value"
@@ -35,7 +35,7 @@ type operationBase struct {
3535
}
3636

3737
func (b operationBase) parseFile(path string) (tv *typed.TypedValue, err error) {
38-
bytes, err := ioutil.ReadFile(path)
38+
bytes, err := os.ReadFile(path)
3939
if err != nil {
4040
return tv, fmt.Errorf("unable to read file %q: %v", path, err)
4141
}

internal/cli/options.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"flag"
2222
"fmt"
2323
"io"
24-
"io/ioutil"
2524
"os"
2625

2726
"sigs.k8s.io/structured-merge-diff/v6/typed"
@@ -76,7 +75,7 @@ func (o *Options) Resolve() (Operation, error) {
7675
if o.schemaPath == "" {
7776
return nil, errors.New("a schema is required")
7877
}
79-
b, err := ioutil.ReadFile(o.schemaPath)
78+
b, err := os.ReadFile(o.schemaPath)
8079
if err != nil {
8180
return nil, fmt.Errorf("unable to read schema %q: %v", o.schemaPath, err)
8281
}

merge/multiple_appliers_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import (
2222
"strings"
2323
"testing"
2424

25-
yaml "go.yaml.in/yaml/v2"
25+
yaml "go.yaml.in/yaml/v3"
2626
"sigs.k8s.io/structured-merge-diff/v6/fieldpath"
2727
. "sigs.k8s.io/structured-merge-diff/v6/internal/fixture"
2828
"sigs.k8s.io/structured-merge-diff/v6/merge"

merge/real_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ limitations under the License.
1717
package merge_test
1818

1919
import (
20-
"io/ioutil"
20+
"os"
2121
"path/filepath"
2222
"testing"
2323

@@ -30,7 +30,7 @@ func testdata(file string) string {
3030
}
3131

3232
func read(file string) []byte {
33-
s, err := ioutil.ReadFile(file)
33+
s, err := os.ReadFile(file)
3434
if err != nil {
3535
panic(err)
3636
}

typed/parser.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ package typed
1919
import (
2020
"fmt"
2121

22-
yaml "go.yaml.in/yaml/v2"
22+
yaml "go.yaml.in/yaml/v3"
2323
"sigs.k8s.io/structured-merge-diff/v6/schema"
2424
"sigs.k8s.io/structured-merge-diff/v6/value"
2525
)

typed/parser_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ limitations under the License.
1717
package typed_test
1818

1919
import (
20-
"io/ioutil"
20+
"os"
2121
"path/filepath"
2222
"strings"
2323
"testing"
2424

25-
yaml "go.yaml.in/yaml/v2"
25+
yaml "go.yaml.in/yaml/v3"
2626
"sigs.k8s.io/structured-merge-diff/v6/typed"
2727
)
2828

@@ -31,7 +31,7 @@ func testdata(file string) string {
3131
}
3232

3333
func read(file string) []byte {
34-
obj, err := ioutil.ReadFile(file)
34+
obj, err := os.ReadFile(file)
3535
if err != nil {
3636
panic(err)
3737
}
@@ -65,7 +65,7 @@ func BenchmarkConvertUnstructured(b *testing.B) {
6565
},
6666
}
6767

68-
s, err := ioutil.ReadFile(testdata("k8s-schema.yaml"))
68+
s, err := os.ReadFile(testdata("k8s-schema.yaml"))
6969
if err != nil {
7070
b.Fatal(err)
7171
}

0 commit comments

Comments
 (0)