Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace deprecated github.com/golang/protobuf package #1183

Merged
merged 1 commit into from
Dec 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions prometheus/counter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ import (
"testing"
"time"

//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/golang/protobuf/proto"
"google.golang.org/protobuf/types/known/timestamppb"

dto "github.com/prometheus/client_model/go"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/timestamppb"
)

func TestCounterAdd(t *testing.T) {
Expand Down
9 changes: 3 additions & 6 deletions prometheus/desc.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,12 @@ import (
"sort"
"strings"

"github.com/cespare/xxhash/v2"

"github.com/prometheus/client_golang/prometheus/internal"

//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/golang/protobuf/proto"
"github.com/prometheus/common/model"

"github.com/cespare/xxhash/v2"
dto "github.com/prometheus/client_model/go"
"github.com/prometheus/common/model"
"google.golang.org/protobuf/proto"
)

// Desc is the descriptor used by every Prometheus Metric. It is essentially
Expand Down
7 changes: 3 additions & 4 deletions prometheus/go_collector_latest.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,10 @@ import (
"strings"
"sync"

//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/golang/protobuf/proto"
dto "github.com/prometheus/client_model/go"

"github.com/prometheus/client_golang/prometheus/internal"

dto "github.com/prometheus/client_model/go"
"google.golang.org/protobuf/proto"
)

const (
Expand Down
5 changes: 2 additions & 3 deletions prometheus/histogram.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ import (
"sync/atomic"
"time"

//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/golang/protobuf/proto"

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

"google.golang.org/protobuf/proto"
)

// nativeHistogramBounds for the frac of observed values. Only relevant for
Expand Down
6 changes: 2 additions & 4 deletions prometheus/histogram_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ import (
"testing/quick"
"time"

//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/golang/protobuf/proto"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/prometheus/client_golang/prometheus/internal"

dto "github.com/prometheus/client_model/go"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/timestamppb"
)

func benchmarkHistogramObserve(w int, b *testing.B) {
Expand Down
6 changes: 2 additions & 4 deletions prometheus/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,9 @@ import (
"strings"
"time"

//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/golang/protobuf/proto"
"github.com/prometheus/common/model"

dto "github.com/prometheus/client_model/go"
"github.com/prometheus/common/model"
"google.golang.org/protobuf/proto"
)

var separatorByteSlice = []byte{model.SeparatorByte} // For convenient use with xxhash.
Expand Down
4 changes: 2 additions & 2 deletions prometheus/metric_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ import (
"math"
"testing"

//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/golang/protobuf/proto"
dto "github.com/prometheus/client_model/go"

"google.golang.org/protobuf/proto"
)

func TestBuildFQName(t *testing.T) {
Expand Down
10 changes: 4 additions & 6 deletions prometheus/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,12 @@ import (
"sync"
"unicode/utf8"

"github.com/cespare/xxhash/v2"
//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/golang/protobuf/proto"
"github.com/prometheus/common/expfmt"
"github.com/prometheus/client_golang/prometheus/internal"

"github.com/cespare/xxhash/v2"
dto "github.com/prometheus/client_model/go"

"github.com/prometheus/client_golang/prometheus/internal"
"github.com/prometheus/common/expfmt"
"google.golang.org/protobuf/proto"
)

const (
Expand Down
10 changes: 4 additions & 6 deletions prometheus/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,14 +31,12 @@ import (
"testing"
"time"

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

//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/golang/protobuf/proto"
"github.com/prometheus/common/expfmt"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/client_golang/prometheus/promhttp"

dto "github.com/prometheus/client_model/go"
"github.com/prometheus/common/expfmt"
"google.golang.org/protobuf/proto"
)

// uncheckedCollector wraps a Collector but its Describe method yields no Desc.
Expand Down
7 changes: 3 additions & 4 deletions prometheus/summary.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ import (
"sync/atomic"
"time"

"github.com/beorn7/perks/quantile"
//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/golang/protobuf/proto"

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

"github.com/beorn7/perks/quantile"
"google.golang.org/protobuf/proto"
)

// quantileLabel is used for the label that defines the quantile in a
Expand Down
6 changes: 2 additions & 4 deletions prometheus/value.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,11 @@ import (
"time"
"unicode/utf8"

//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/golang/protobuf/proto"
"google.golang.org/protobuf/types/known/timestamppb"

"github.com/prometheus/client_golang/prometheus/internal"

dto "github.com/prometheus/client_model/go"
"google.golang.org/protobuf/proto"
"google.golang.org/protobuf/types/known/timestamppb"
)

// ValueType is an enumeration of metric types that represent a simple value.
Expand Down
6 changes: 2 additions & 4 deletions prometheus/wrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,10 @@ import (
"fmt"
"sort"

//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/golang/protobuf/proto"
"github.com/prometheus/client_golang/prometheus/internal"

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

"github.com/prometheus/client_golang/prometheus/internal"
"google.golang.org/protobuf/proto"
)

// WrapRegistererWith returns a Registerer wrapping the provided
Expand Down
7 changes: 2 additions & 5 deletions prometheus/wrap_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ import (
"strings"
"testing"

//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
"github.com/golang/protobuf/proto"

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

Expand Down Expand Up @@ -304,10 +301,10 @@ func TestWrap(t *testing.T) {
var want, got []string

for i, mf := range wantMF {
want = append(want, fmt.Sprintf("%3d: %s", i, proto.MarshalTextString(mf)))
want = append(want, fmt.Sprintf("%3d: %s", i, mf))
}
for i, mf := range gotMF {
got = append(got, fmt.Sprintf("%3d: %s", i, proto.MarshalTextString(mf)))
got = append(got, fmt.Sprintf("%3d: %s", i, mf))
}

t.Fatalf(
Expand Down