From 51d33be87806e3dc0e889dee73358394c19701ff Mon Sep 17 00:00:00 2001 From: Arve Knudsen Date: Tue, 3 Feb 2026 15:15:35 +0100 Subject: [PATCH] web: switch from gopkg.in/yaml to go.yaml.in/yaml (#17979) Replace gopkg.in/yaml.v2 and gopkg.in/yaml.v3 imports with go.yaml.in/yaml/v2 and go.yaml.in/yaml/v3 respectively. Signed-off-by: Arve Knudsen --- .golangci.yml | 4 ++++ go.mod | 4 ++-- web/api/v1/openapi_golden_test.go | 2 +- web/api/v1/openapi_test.go | 2 +- 4 files changed, 8 insertions(+), 4 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 599a5e2b49..8cb3265f4f 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -102,6 +102,10 @@ linters: desc: "Use github.com/klauspost/compress instead of zlib" - pkg: "golang.org/x/exp/slices" desc: "Use 'slices' instead." + - pkg: "gopkg.in/yaml.v2" + desc: "Use go.yaml.in/yaml/v2 instead of gopkg.in/yaml.v2" + - pkg: "gopkg.in/yaml.v3" + desc: "Use go.yaml.in/yaml/v3 instead of gopkg.in/yaml.v3" errcheck: exclude-functions: # Don't flag lines such as "io.Copy(io.Discard, resp.Body)". diff --git a/go.mod b/go.mod index 0aa3658177..7ceb746720 100644 --- a/go.mod +++ b/go.mod @@ -96,7 +96,6 @@ require ( google.golang.org/genproto/googleapis/api v0.0.0-20251222181119-0a764e51fe1b google.golang.org/grpc v1.78.0 google.golang.org/protobuf v1.36.11 - gopkg.in/yaml.v3 v3.0.1 k8s.io/api v0.34.3 k8s.io/apimachinery v0.34.3 k8s.io/client-go v0.34.3 @@ -124,6 +123,8 @@ require ( github.com/pb33f/ordered-map/v2 v2.3.0 // indirect github.com/santhosh-tekuri/jsonschema/v6 v6.0.2 // indirect go.uber.org/multierr v1.11.0 // indirect + gopkg.in/yaml.v2 v2.4.0 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect ) @@ -246,7 +247,6 @@ require ( gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/ini.v1 v1.67.0 // indirect - gopkg.in/yaml.v2 v2.4.0 gotest.tools/v3 v3.0.3 // indirect k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect diff --git a/web/api/v1/openapi_golden_test.go b/web/api/v1/openapi_golden_test.go index 6207fda81b..468d56e46d 100644 --- a/web/api/v1/openapi_golden_test.go +++ b/web/api/v1/openapi_golden_test.go @@ -20,7 +20,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v3" + "go.yaml.in/yaml/v3" "github.com/prometheus/prometheus/web/api/testhelpers" ) diff --git a/web/api/v1/openapi_test.go b/web/api/v1/openapi_test.go index 0d2f5cc83e..21547734c2 100644 --- a/web/api/v1/openapi_test.go +++ b/web/api/v1/openapi_test.go @@ -21,7 +21,7 @@ import ( "github.com/prometheus/common/promslog" "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" + "go.yaml.in/yaml/v2" ) // TestOpenAPIHTTPHandler verifies that the OpenAPI endpoint serves a valid specification