Skip to content

Commit ae1a9df

Browse files
committed
Migrate from yaml.v3 to goccy/go-yaml
Replace gopkg.in/yaml.v3 with github.com/goccy/go-yaml across all 5 source files. Rewrite duration.UnmarshalYAML from *yaml.Node signature to callback signature. Update go.mod and vendor; yaml.v3 fully removed.
1 parent 482d75a commit ae1a9df

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+15085
-11509
lines changed

agent/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
env "github.com/jhunt/go-envirotron"
1414
"github.com/shieldproject/shield/internal/log"
1515
"golang.org/x/crypto/ssh"
16-
"gopkg.in/yaml.v3"
16+
"github.com/goccy/go-yaml"
1717
)
1818

1919
type Config struct {

cmd/shield/cmd_misc.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
fmt "github.com/jhunt/go-ansi"
1111
"github.com/jhunt/go-table"
1212
"github.com/spf13/cobra"
13-
"gopkg.in/yaml.v3"
13+
"github.com/goccy/go-yaml"
1414

1515
"github.com/shieldproject/shield/client/v2/shield"
1616
)

cmd/shield/config.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55
"io/ioutil"
66
"os"
77

8-
"gopkg.in/yaml.v3"
8+
"github.com/goccy/go-yaml"
99
)
1010

1111
type LegacyConfig struct {

core/core.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
env "github.com/jhunt/go-envirotron"
1212
log "github.com/shieldproject/shield/internal/log"
1313
"golang.org/x/crypto/ssh"
14-
"gopkg.in/yaml.v3"
14+
"github.com/goccy/go-yaml"
1515

1616
"github.com/shieldproject/shield/core/bus"
1717
"github.com/shieldproject/shield/core/fabric"

core/duration.go

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import (
55
"regexp"
66
"strconv"
77

8-
"gopkg.in/yaml.v3"
98
)
109

1110
var durationPattern *regexp.Regexp
@@ -85,8 +84,12 @@ func (d duration) parse(raw string) (int, error) {
8584
return 0, fmt.Errorf("unrecognized duration unit '%s' (in '%s')", m[2], raw)
8685
}
8786

88-
func (d *duration) UnmarshalYAML(value *yaml.Node) error {
89-
d.UnmarshalEnv(value.Value)
87+
func (d *duration) UnmarshalYAML(unmarshal func(interface{}) error) error {
88+
var raw string
89+
if err := unmarshal(&raw); err != nil {
90+
return err
91+
}
92+
d.UnmarshalEnv(raw)
9093
return nil
9194
}
9295

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ require (
1111
github.com/cloudfoundry-community/vaultkv v0.7.0
1212
github.com/fsouza/go-dockerclient v1.13.0
1313
github.com/go-sql-driver/mysql v1.9.3
14+
github.com/goccy/go-yaml v1.18.0
1415
github.com/google/go-github/v66 v66.0.0
1516
github.com/gorilla/websocket v1.5.3
1617
github.com/hashicorp/consul/api v1.33.7
@@ -34,7 +35,6 @@ require (
3435
golang.org/x/net v0.52.0
3536
golang.org/x/oauth2 v0.36.0
3637
google.golang.org/api v0.273.0
37-
gopkg.in/yaml.v3 v3.0.1
3838
)
3939

4040
require (

vendor/github.com/goccy/go-yaml/.codecov.yml

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/goccy/go-yaml/.gitignore

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/goccy/go-yaml/.golangci.yml

Lines changed: 65 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

vendor/github.com/goccy/go-yaml/CHANGELOG.md

Lines changed: 186 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)