From 55934f14d4247e6dde97c5c9ba39ccf137088119 Mon Sep 17 00:00:00 2001 From: "R.I.Pienaar" Date: Wed, 31 Dec 2025 20:21:07 +0100 Subject: [PATCH] (misc) Move to new yaml library Signed-off-by: R.I.Pienaar --- aagent/machine/machine.go | 9 +++++---- aagent/machine/machine_test.go | 5 +++-- aagent/watchers/ccmmanifestwatcher/ccmmanifest.go | 2 +- aagent/watchers/machineswatcher/manager/plugin.go | 5 +++-- aagent/watchers/pluginswatcher/machinesmanager/plugin.go | 5 +++-- aagent/watchers/pluginswatcher/plugins_test.go | 7 ++++--- filter/facts/facts.go | 4 ++-- go.mod | 2 +- plugin/plugin.go | 5 +++-- protocol/filter_test.go | 4 ++-- providers/discovery/flatfile/flatfile.go | 9 ++++----- providers/discovery/inventory/inventory.go | 7 ++++--- 12 files changed, 35 insertions(+), 29 deletions(-) diff --git a/aagent/machine/machine.go b/aagent/machine/machine.go index 6e2ef16c5..e7ddd8664 100644 --- a/aagent/machine/machine.go +++ b/aagent/machine/machine.go @@ -14,16 +14,17 @@ import ( "sync" "time" + "github.com/goccy/go-yaml" + "github.com/looplab/fsm" + "github.com/nats-io/jsm.go" + "github.com/sirupsen/logrus" + "github.com/choria-io/go-choria/aagent/model" "github.com/choria-io/go-choria/aagent/watchers" "github.com/choria-io/go-choria/backoff" "github.com/choria-io/go-choria/inter" "github.com/choria-io/go-choria/internal/util" "github.com/choria-io/go-choria/lifecycle" - "github.com/ghodss/yaml" - "github.com/looplab/fsm" - "github.com/nats-io/jsm.go" - "github.com/sirupsen/logrus" ) const dataFileName = "machine_data.json" diff --git a/aagent/machine/machine_test.go b/aagent/machine/machine_test.go index 18e954227..ab9b43efc 100644 --- a/aagent/machine/machine_test.go +++ b/aagent/machine/machine_test.go @@ -12,10 +12,11 @@ import ( "testing" "time" + "github.com/goccy/go-yaml" + "github.com/sirupsen/logrus" + "github.com/choria-io/go-choria/aagent/plugin" "github.com/choria-io/go-choria/aagent/watchers" - "github.com/ghodss/yaml" - "github.com/sirupsen/logrus" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" diff --git a/aagent/watchers/ccmmanifestwatcher/ccmmanifest.go b/aagent/watchers/ccmmanifestwatcher/ccmmanifest.go index 584946eaa..63571bf9e 100644 --- a/aagent/watchers/ccmmanifestwatcher/ccmmanifest.go +++ b/aagent/watchers/ccmmanifestwatcher/ccmmanifest.go @@ -16,7 +16,7 @@ import ( "sync" "time" - "github.com/ghodss/yaml" + "github.com/goccy/go-yaml" "github.com/choria-io/ccm/manager" ccmmodel "github.com/choria-io/ccm/model" diff --git a/aagent/watchers/machineswatcher/manager/plugin.go b/aagent/watchers/machineswatcher/manager/plugin.go index 56fce7b87..1979f032a 100644 --- a/aagent/watchers/machineswatcher/manager/plugin.go +++ b/aagent/watchers/machineswatcher/manager/plugin.go @@ -1,4 +1,4 @@ -// Copyright (c) 2021, R.I. Pienaar and the Choria Project contributors +// Copyright (c) 2021-2025, R.I. Pienaar and the Choria Project contributors // // SPDX-License-Identifier: Apache-2.0 @@ -7,9 +7,10 @@ package machines_manager import ( _ "embed" + "github.com/goccy/go-yaml" + "github.com/choria-io/go-choria/aagent/machine" "github.com/choria-io/go-choria/aagent/plugin" - "github.com/ghodss/yaml" ) var ( diff --git a/aagent/watchers/pluginswatcher/machinesmanager/plugin.go b/aagent/watchers/pluginswatcher/machinesmanager/plugin.go index 451b6e146..f30303658 100644 --- a/aagent/watchers/pluginswatcher/machinesmanager/plugin.go +++ b/aagent/watchers/pluginswatcher/machinesmanager/plugin.go @@ -1,4 +1,4 @@ -// Copyright (c) 2021, R.I. Pienaar and the Choria Project contributors +// Copyright (c) 2021-2025, R.I. Pienaar and the Choria Project contributors // // SPDX-License-Identifier: Apache-2.0 @@ -7,9 +7,10 @@ package machines_manager import ( _ "embed" + "github.com/goccy/go-yaml" + "github.com/choria-io/go-choria/aagent/machine" "github.com/choria-io/go-choria/aagent/plugin" - "github.com/ghodss/yaml" ) var ( diff --git a/aagent/watchers/pluginswatcher/plugins_test.go b/aagent/watchers/pluginswatcher/plugins_test.go index 026b01596..fa838b9d3 100644 --- a/aagent/watchers/pluginswatcher/plugins_test.go +++ b/aagent/watchers/pluginswatcher/plugins_test.go @@ -14,12 +14,13 @@ import ( "testing" "time" - "github.com/choria-io/go-choria/aagent/model" - iu "github.com/choria-io/go-choria/internal/util" - "github.com/ghodss/yaml" + "github.com/goccy/go-yaml" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "go.uber.org/mock/gomock" + + "github.com/choria-io/go-choria/aagent/model" + iu "github.com/choria-io/go-choria/internal/util" ) func TestMachine(t *testing.T) { diff --git a/filter/facts/facts.go b/filter/facts/facts.go index 5ebe16c09..f011e2857 100644 --- a/filter/facts/facts.go +++ b/filter/facts/facts.go @@ -1,4 +1,4 @@ -// Copyright (c) 2019-2022, R.I. Pienaar and the Choria Project contributors +// Copyright (c) 2019-2025, R.I. Pienaar and the Choria Project contributors // // SPDX-License-Identifier: Apache-2.0 @@ -13,7 +13,7 @@ import ( "github.com/tidwall/gjson" - "github.com/ghodss/yaml" + "github.com/goccy/go-yaml" "github.com/choria-io/go-choria/internal/util" ) diff --git a/go.mod b/go.mod index 7acbf3b68..0004b4f17 100644 --- a/go.mod +++ b/go.mod @@ -20,6 +20,7 @@ require ( github.com/fatih/structtag v1.2.0 github.com/freman/eventloghook v0.0.0-20250604093238-a195f2852650 github.com/ghodss/yaml v1.0.0 + github.com/goccy/go-yaml v1.19.1 github.com/gofrs/uuid v4.4.0+incompatible github.com/golang-jwt/jwt/v4 v4.5.2 github.com/google/go-cmp v0.7.0 @@ -87,7 +88,6 @@ require ( github.com/go-task/slim-sprig/v3 v3.0.0 // indirect github.com/gobwas/glob v0.2.3 // indirect github.com/goccy/go-json v0.10.5 // indirect - github.com/goccy/go-yaml v1.19.1 // indirect github.com/google/go-tpm v0.9.8 // indirect github.com/google/pprof v0.0.0-20251213031049-b05bdaca462f // indirect github.com/google/uuid v1.6.0 // indirect diff --git a/plugin/plugin.go b/plugin/plugin.go index d599e4ccf..94b6da551 100644 --- a/plugin/plugin.go +++ b/plugin/plugin.go @@ -1,4 +1,4 @@ -// Copyright (c) 2018-2022, R.I. Pienaar and the Choria Project contributors +// Copyright (c) 2018-2025, R.I. Pienaar and the Choria Project contributors // // SPDX-License-Identifier: Apache-2.0 @@ -10,9 +10,10 @@ import ( "sort" "time" + "github.com/goccy/go-yaml" + "github.com/choria-io/go-choria/inter" "github.com/choria-io/go-choria/internal/fs" - "github.com/ghodss/yaml" ) // List is a list of plugins to load diff --git a/protocol/filter_test.go b/protocol/filter_test.go index 081d986f1..2f31070ea 100644 --- a/protocol/filter_test.go +++ b/protocol/filter_test.go @@ -1,4 +1,4 @@ -// Copyright (c) 2017-2021, R.I. Pienaar and the Choria Project contributors +// Copyright (c) 2017-2025, R.I. Pienaar and the Choria Project contributors // // SPDX-License-Identifier: Apache-2.0 @@ -9,7 +9,7 @@ import ( "os" "testing" - "github.com/ghodss/yaml" + "github.com/goccy/go-yaml" . "github.com/onsi/ginkgo/v2" . "github.com/onsi/gomega" "github.com/sirupsen/logrus" diff --git a/providers/discovery/flatfile/flatfile.go b/providers/discovery/flatfile/flatfile.go index 863525051..ab3b8b206 100644 --- a/providers/discovery/flatfile/flatfile.go +++ b/providers/discovery/flatfile/flatfile.go @@ -1,4 +1,4 @@ -// Copyright (c) 2021-2022, R.I. Pienaar and the Choria Project contributors +// Copyright (c) 2021-2025, R.I. Pienaar and the Choria Project contributors // // SPDX-License-Identifier: Apache-2.0 @@ -16,14 +16,13 @@ import ( "strings" "time" - "github.com/choria-io/go-choria/inter" + "github.com/goccy/go-yaml" + "github.com/sirupsen/logrus" "github.com/tidwall/gjson" "github.com/choria-io/go-choria/filter/identity" + "github.com/choria-io/go-choria/inter" "github.com/choria-io/go-choria/providers/agent/mcorpc/replyfmt" - - "github.com/ghodss/yaml" - "github.com/sirupsen/logrus" ) const validIdentity = `^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9])$` diff --git a/providers/discovery/inventory/inventory.go b/providers/discovery/inventory/inventory.go index 0fc8b2502..dc9bb93af 100644 --- a/providers/discovery/inventory/inventory.go +++ b/providers/discovery/inventory/inventory.go @@ -1,4 +1,4 @@ -// Copyright (c) 2021, R.I. Pienaar and the Choria Project contributors +// Copyright (c) 2021-2025, R.I. Pienaar and the Choria Project contributors // // SPDX-License-Identifier: Apache-2.0 @@ -12,11 +12,12 @@ import ( "path/filepath" "strings" - "github.com/choria-io/go-choria/inter" "github.com/expr-lang/expr/vm" - "github.com/ghodss/yaml" + "github.com/goccy/go-yaml" "github.com/sirupsen/logrus" + "github.com/choria-io/go-choria/inter" + "github.com/choria-io/go-choria/filter/compound" "github.com/choria-io/go-choria/internal/util" "github.com/choria-io/go-choria/protocol"