Skip to content

Commit 685511b

Browse files
authored
Fix/rule-marshal-unmarshal (#643)
* build: address yaml marshal and unmarshal issue Signed-off-by: wuhuizuo <wuhuizuo@126.com> * build: address yaml marshal and unmarshal issue Signed-off-by: wuhuizuo <wuhuizuo@126.com> * Revert "build: address yaml marshal and unmarshal issue" This reverts commit 17f25f4. --------- Signed-off-by: wuhuizuo <wuhuizuo@126.com>
1 parent 3d4256c commit 685511b

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

cmd/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ import (
3737
"github.com/tidwall/sjson"
3838
"github.com/youthlin/stream"
3939
streamtypes "github.com/youthlin/stream/types"
40-
"gopkg.in/yaml.v2"
40+
"gopkg.in/yaml.v3"
4141
)
4242

4343
const (

cmd/monitoring.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/youthlin/stream"
1717
streamtypes "github.com/youthlin/stream/types"
1818
"golang.org/x/oauth2"
19-
"gopkg.in/yaml.v2"
19+
"gopkg.in/yaml.v3"
2020

2121
"github.com/pingcap/monitoring/pkg/ansible"
2222
"github.com/pingcap/monitoring/pkg/common"
@@ -428,7 +428,7 @@ func removeLastSlash(str string) string {
428428
func Load(s string) (*Config, error) {
429429
cfg := &Config{}
430430

431-
err := yaml.UnmarshalStrict([]byte(s), cfg)
431+
err := yaml.Unmarshal([]byte(s), cfg)
432432
if err != nil {
433433
return nil, err
434434
}

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ require (
1818
github.com/tidwall/sjson v1.2.5
1919
github.com/youthlin/stream v0.0.3
2020
golang.org/x/oauth2 v0.23.0
21-
gopkg.in/yaml.v2 v2.4.0
21+
gopkg.in/yaml.v3 v3.0.1
2222
k8s.io/client-go v0.29.3
2323
)
2424

@@ -96,7 +96,7 @@ require (
9696
google.golang.org/protobuf v1.34.2 // indirect
9797
gopkg.in/inf.v0 v0.9.1 // indirect
9898
gopkg.in/warnings.v0 v0.1.2 // indirect
99-
gopkg.in/yaml.v3 v3.0.1 // indirect
99+
gopkg.in/yaml.v2 v2.4.0 // indirect
100100
k8s.io/apimachinery v0.29.3 // indirect
101101
k8s.io/klog/v2 v2.130.1 // indirect
102102
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect

pkg/operator/rules.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/prometheus/prometheus/model/rulefmt"
1111
"github.com/youthlin/stream"
1212
streamtypes "github.com/youthlin/stream/types"
13-
"gopkg.in/yaml.v2"
13+
"gopkg.in/yaml.v3"
1414
)
1515

1616
const (

0 commit comments

Comments
 (0)