From dba1478b8a68bebf5553ebc220c84532c977a0c1 Mon Sep 17 00:00:00 2001 From: beorn7 Date: Thu, 14 May 2020 20:04:11 +0200 Subject: [PATCH] Add lint:ignore for protobuf deprecation `github.com/golang/protobuf/proto` is deprecated in lieu of `google.golang.org/protobuf/proto`. However, we cannot simply migrate. Types from the proto package are exposed to users of packages in this repo. If we migrate here, users have to migrate to. Thus, we could only migrate with a major version bump. In different news, with all the inline lint:ignore comments, including the existing ones, there is no need to repeat the exception in the Makefile. A current version of `staticcheck` is happy with the code after this commit. golangci-lint is broken at the moment, however, and ignores the lint:ignore comments in the code as well as those via envvar. Signed-off-by: beorn7 --- Makefile | 7 ------- prometheus/counter_test.go | 1 + prometheus/desc.go | 1 + prometheus/examples_test.go | 1 + prometheus/histogram.go | 1 + prometheus/histogram_test.go | 1 + prometheus/metric.go | 1 + prometheus/registry.go | 1 + prometheus/registry_test.go | 1 + prometheus/summary.go | 1 + prometheus/value.go | 1 + prometheus/wrap.go | 1 + prometheus/wrap_test.go | 1 + 13 files changed, 12 insertions(+), 7 deletions(-) diff --git a/Makefile b/Makefile index b25fb83..f35cf58 100644 --- a/Makefile +++ b/Makefile @@ -13,13 +13,6 @@ include Makefile.common -# http.CloseNotifier is deprecated but we don't want to remove support -# from client_golang to not break anybody still using it. -STATICCHECK_IGNORE = \ - github.com/prometheus/client_golang/prometheus/promhttp/delegator*.go:SA1019 \ - github.com/prometheus/client_golang/prometheus/promhttp/instrument_server_test.go:SA1019 \ - github.com/prometheus/client_golang/prometheus/http.go:SA1019 - .PHONY: test test: deps common-test diff --git a/prometheus/counter_test.go b/prometheus/counter_test.go index e2e31fc..56652a0 100644 --- a/prometheus/counter_test.go +++ b/prometheus/counter_test.go @@ -19,6 +19,7 @@ import ( "testing" "time" + //lint:ignore SA1019 Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" diff --git a/prometheus/desc.go b/prometheus/desc.go index e3232d7..2f19f5e 100644 --- a/prometheus/desc.go +++ b/prometheus/desc.go @@ -20,6 +20,7 @@ import ( "strings" "github.com/cespare/xxhash/v2" + //lint:ignore SA1019 Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" "github.com/prometheus/common/model" diff --git a/prometheus/examples_test.go b/prometheus/examples_test.go index 903d4d9..8bc051a 100644 --- a/prometheus/examples_test.go +++ b/prometheus/examples_test.go @@ -22,6 +22,7 @@ import ( "strings" "time" + //lint:ignore SA1019 Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" "github.com/prometheus/common/expfmt" diff --git a/prometheus/histogram.go b/prometheus/histogram.go index 4271f43..3a5aac7 100644 --- a/prometheus/histogram.go +++ b/prometheus/histogram.go @@ -22,6 +22,7 @@ import ( "sync/atomic" "time" + //lint:ignore SA1019 Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" dto "github.com/prometheus/client_model/go" diff --git a/prometheus/histogram_test.go b/prometheus/histogram_test.go index 2e8f4b8..0b4826c 100644 --- a/prometheus/histogram_test.go +++ b/prometheus/histogram_test.go @@ -24,6 +24,7 @@ import ( "testing/quick" "time" + //lint:ignore SA1019 Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" diff --git a/prometheus/metric.go b/prometheus/metric.go index 0df1eff..35bd8bd 100644 --- a/prometheus/metric.go +++ b/prometheus/metric.go @@ -17,6 +17,7 @@ import ( "strings" "time" + //lint:ignore SA1019 Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" "github.com/prometheus/common/model" diff --git a/prometheus/registry.go b/prometheus/registry.go index c05d6ee..ba94405 100644 --- a/prometheus/registry.go +++ b/prometheus/registry.go @@ -26,6 +26,7 @@ import ( "unicode/utf8" "github.com/cespare/xxhash/v2" + //lint:ignore SA1019 Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" "github.com/prometheus/common/expfmt" diff --git a/prometheus/registry_test.go b/prometheus/registry_test.go index 67e4fcb..48596cd 100644 --- a/prometheus/registry_test.go +++ b/prometheus/registry_test.go @@ -33,6 +33,7 @@ import ( dto "github.com/prometheus/client_model/go" + //lint:ignore SA1019 Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" "github.com/prometheus/common/expfmt" diff --git a/prometheus/summary.go b/prometheus/summary.go index ae42e76..f3c1440 100644 --- a/prometheus/summary.go +++ b/prometheus/summary.go @@ -23,6 +23,7 @@ import ( "time" "github.com/beorn7/perks/quantile" + //lint:ignore SA1019 Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" dto "github.com/prometheus/client_model/go" diff --git a/prometheus/value.go b/prometheus/value.go index 2be470c..6206928 100644 --- a/prometheus/value.go +++ b/prometheus/value.go @@ -19,6 +19,7 @@ import ( "time" "unicode/utf8" + //lint:ignore SA1019 Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" "github.com/golang/protobuf/ptypes" diff --git a/prometheus/wrap.go b/prometheus/wrap.go index e303eef..da6896a 100644 --- a/prometheus/wrap.go +++ b/prometheus/wrap.go @@ -17,6 +17,7 @@ import ( "fmt" "sort" + //lint:ignore SA1019 Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" dto "github.com/prometheus/client_model/go" diff --git a/prometheus/wrap_test.go b/prometheus/wrap_test.go index 0fbb78c..256875a 100644 --- a/prometheus/wrap_test.go +++ b/prometheus/wrap_test.go @@ -19,6 +19,7 @@ import ( "strings" "testing" + //lint:ignore SA1019 Need to keep deprecated package for compatibility. "github.com/golang/protobuf/proto" dto "github.com/prometheus/client_model/go"