Skip to content

Commit dba1478

Browse files
committed
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 <[email protected]>
1 parent ce2dae2 commit dba1478

13 files changed

+12
-7
lines changed

Makefile

-7
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,6 @@
1313

1414
include Makefile.common
1515

16-
# http.CloseNotifier is deprecated but we don't want to remove support
17-
# from client_golang to not break anybody still using it.
18-
STATICCHECK_IGNORE = \
19-
github.com/prometheus/client_golang/prometheus/promhttp/delegator*.go:SA1019 \
20-
github.com/prometheus/client_golang/prometheus/promhttp/instrument_server_test.go:SA1019 \
21-
github.com/prometheus/client_golang/prometheus/http.go:SA1019
22-
2316
.PHONY: test
2417
test: deps common-test
2518

prometheus/counter_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"testing"
2020
"time"
2121

22+
//lint:ignore SA1019 Need to keep deprecated package for compatibility.
2223
"github.com/golang/protobuf/proto"
2324
"github.com/golang/protobuf/ptypes"
2425

prometheus/desc.go

+1
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import (
2020
"strings"
2121

2222
"github.com/cespare/xxhash/v2"
23+
//lint:ignore SA1019 Need to keep deprecated package for compatibility.
2324
"github.com/golang/protobuf/proto"
2425
"github.com/prometheus/common/model"
2526

prometheus/examples_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"strings"
2323
"time"
2424

25+
//lint:ignore SA1019 Need to keep deprecated package for compatibility.
2526
"github.com/golang/protobuf/proto"
2627
"github.com/prometheus/common/expfmt"
2728

prometheus/histogram.go

+1
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import (
2222
"sync/atomic"
2323
"time"
2424

25+
//lint:ignore SA1019 Need to keep deprecated package for compatibility.
2526
"github.com/golang/protobuf/proto"
2627

2728
dto "github.com/prometheus/client_model/go"

prometheus/histogram_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"testing/quick"
2525
"time"
2626

27+
//lint:ignore SA1019 Need to keep deprecated package for compatibility.
2728
"github.com/golang/protobuf/proto"
2829
"github.com/golang/protobuf/ptypes"
2930

prometheus/metric.go

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"strings"
1818
"time"
1919

20+
//lint:ignore SA1019 Need to keep deprecated package for compatibility.
2021
"github.com/golang/protobuf/proto"
2122
"github.com/prometheus/common/model"
2223

prometheus/registry.go

+1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import (
2626
"unicode/utf8"
2727

2828
"github.com/cespare/xxhash/v2"
29+
//lint:ignore SA1019 Need to keep deprecated package for compatibility.
2930
"github.com/golang/protobuf/proto"
3031
"github.com/prometheus/common/expfmt"
3132

prometheus/registry_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333

3434
dto "github.com/prometheus/client_model/go"
3535

36+
//lint:ignore SA1019 Need to keep deprecated package for compatibility.
3637
"github.com/golang/protobuf/proto"
3738
"github.com/prometheus/common/expfmt"
3839

prometheus/summary.go

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import (
2323
"time"
2424

2525
"github.com/beorn7/perks/quantile"
26+
//lint:ignore SA1019 Need to keep deprecated package for compatibility.
2627
"github.com/golang/protobuf/proto"
2728

2829
dto "github.com/prometheus/client_model/go"

prometheus/value.go

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"time"
2020
"unicode/utf8"
2121

22+
//lint:ignore SA1019 Need to keep deprecated package for compatibility.
2223
"github.com/golang/protobuf/proto"
2324
"github.com/golang/protobuf/ptypes"
2425

prometheus/wrap.go

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"fmt"
1818
"sort"
1919

20+
//lint:ignore SA1019 Need to keep deprecated package for compatibility.
2021
"github.com/golang/protobuf/proto"
2122

2223
dto "github.com/prometheus/client_model/go"

prometheus/wrap_test.go

+1
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"strings"
2020
"testing"
2121

22+
//lint:ignore SA1019 Need to keep deprecated package for compatibility.
2223
"github.com/golang/protobuf/proto"
2324

2425
dto "github.com/prometheus/client_model/go"

0 commit comments

Comments
 (0)