Skip to content

Commit f18967b

Browse files
committed
go/solution-operator-lib: bump Go version to 1.24
1 parent a8cae1a commit f18967b

File tree

5 files changed

+25
-28
lines changed

5 files changed

+25
-28
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@
3333
- Allow to enable metrics collection for the solutions operators
3434
(PR[#4813](https://github.com/scality/metalk8s/pull/4813))
3535

36+
- Bump solution-operator-lib Go version to 1.24
37+
(PR[#4817](https://github.com/scality/metalk8s/pull/4817))
38+
3639
### Bug Fixes
3740

3841
- Fix a bug where part of the upgrade process would silently be skipped

go/solution-operator-lib/go.mod

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
module github.com/scality/metalk8s/go/solution-operator-lib
22

3-
go 1.13
3+
go 1.24.0
44

55
require (
6-
github.com/stretchr/testify v1.6.1
7-
gopkg.in/yaml.v2 v2.3.0
6+
github.com/stretchr/testify v1.11.1
7+
gopkg.in/yaml.v3 v3.0.1
8+
)
9+
10+
require (
11+
github.com/davecgh/go-spew v1.1.1 // indirect
12+
github.com/pmezard/go-difflib v1.0.0 // indirect
813
)

go/solution-operator-lib/go.sum

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
1-
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
2-
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
1+
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
2+
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
33
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
44
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
5-
github.com/stretchr/objx v0.1.0 h1:4G4v2dO3VZwixGIRoQ5Lfboy6nUhCyYzaqnIAPPhYs4=
6-
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
7-
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
8-
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
5+
github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U=
6+
github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U=
7+
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
98
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
10-
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
11-
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
12-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
13-
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
9+
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
10+
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

go/solution-operator-lib/pkg/config/config.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,9 @@ package config
33
import (
44
"fmt"
55
"io"
6-
"io/ioutil"
76
"os"
87

9-
"gopkg.in/yaml.v2"
8+
"gopkg.in/yaml.v3"
109
)
1110

1211
const expectedAPIVersion = "solutions.metalk8s.scality.com/v1alpha1"
@@ -32,12 +31,10 @@ type Repository struct {
3231
func LoadConfiguration(input io.Reader) (*OperatorConfig, error) {
3332
var config OperatorConfig
3433

35-
buffer, err := ioutil.ReadAll(input)
36-
if err != nil {
37-
return nil, fmt.Errorf("cannot read operator configuration: %w", err)
38-
}
34+
decoder := yaml.NewDecoder(input)
35+
decoder.KnownFields(true)
3936

40-
if err := yaml.UnmarshalStrict(buffer, &config); err != nil {
37+
if err := decoder.Decode(&config); err != nil {
4138
return nil, validationError(err)
4239
}
4340

go/solution-operator-lib/pkg/config/config_test.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,7 @@ func TestLoadConfigurationOnBrokenFile(t *testing.T) {
177177

178178
assert.Nil(t, result)
179179
assert.Error(t, err)
180-
// This error is not about validation
181-
assert.False(t, errors.Is(err, ErrValidation))
182-
assert.True(t, errors.Is(err, errBrokenBuffer))
183-
assert.Equal(
184-
t,
185-
"cannot read operator configuration: this buffer is broken",
186-
err.Error(),
187-
)
180+
// This error is about parsing the YAML file
181+
assert.True(t, errors.Is(err, ErrValidation))
182+
assert.Contains(t, err.Error(), "yaml: input error: this buffer is broken")
188183
}

0 commit comments

Comments
 (0)