Skip to content

Commit a2ac260

Browse files
authored
Merge pull request #479 from prometheus/superq/updates
Update Go modules
2 parents 92f8c27 + 5e8c998 commit a2ac260

File tree

12 files changed

+47
-47
lines changed

12 files changed

+47
-47
lines changed

expfmt/decode.go

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,10 @@ func (d *textDecoder) Decode(v *dto.MetricFamily) error {
132132
}
133133
// Pick off one MetricFamily per Decode until there's nothing left.
134134
for key, fam := range d.fams {
135-
*v = *fam
135+
v.Name = fam.Name
136+
v.Help = fam.Help
137+
v.Type = fam.Type
138+
v.Metric = fam.Metric
136139
delete(d.fams, key)
137140
return nil
138141
}

expfmt/decode_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ import (
2222
"strings"
2323
"testing"
2424

25-
"github.com/golang/protobuf/proto" //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
2625
dto "github.com/prometheus/client_model/go"
26+
"google.golang.org/protobuf/proto"
2727

2828
"github.com/prometheus/common/model"
2929
)

expfmt/encode.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,9 @@ import (
1818
"io"
1919
"net/http"
2020

21-
"github.com/golang/protobuf/proto" //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
2221
"github.com/matttproud/golang_protobuf_extensions/pbutil"
2322
"github.com/prometheus/common/internal/bitbucket.org/ww/goautoneg"
23+
"google.golang.org/protobuf/encoding/prototext"
2424

2525
dto "github.com/prometheus/client_model/go"
2626
)
@@ -136,7 +136,7 @@ func NewEncoder(w io.Writer, format Format) Encoder {
136136
case FmtProtoText:
137137
return encoderCloser{
138138
encode: func(v *dto.MetricFamily) error {
139-
_, err := fmt.Fprintln(w, proto.MarshalTextString(v))
139+
_, err := fmt.Fprintln(w, prototext.Format(v))
140140
return err
141141
},
142142
close: func() error { return nil },

expfmt/encode_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ import (
1818
"net/http"
1919
"testing"
2020

21-
"github.com/golang/protobuf/proto" //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
2221
dto "github.com/prometheus/client_model/go"
22+
"google.golang.org/protobuf/proto"
2323
)
2424

2525
func TestNegotiate(t *testing.T) {

expfmt/openmetrics_create_test.go

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,16 +20,15 @@ import (
2020
"testing"
2121
"time"
2222

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

2626
dto "github.com/prometheus/client_model/go"
2727
)
2828

2929
func TestCreateOpenMetrics(t *testing.T) {
30-
openMetricsTimestamp, err := ptypes.TimestampProto(time.Unix(12345, 600000000)) //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
31-
32-
if err != nil {
30+
openMetricsTimestamp := timestamppb.New(time.Unix(12345, 600000000))
31+
if err := openMetricsTimestamp.CheckValid(); err != nil {
3332
t.Error(err)
3433
}
3534

expfmt/text_create_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import (
1919
"strings"
2020
"testing"
2121

22-
"github.com/golang/protobuf/proto" //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
22+
"google.golang.org/protobuf/proto"
2323

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

expfmt/text_parse.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,8 +24,8 @@ import (
2424

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

27-
"github.com/golang/protobuf/proto" //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
2827
"github.com/prometheus/common/model"
28+
"google.golang.org/protobuf/proto"
2929
)
3030

3131
// A stateFn is a function that represents a state in a state machine. By

expfmt/text_parse_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,8 @@ import (
1919
"strings"
2020
"testing"
2121

22-
"github.com/golang/protobuf/proto" //nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
2322
dto "github.com/prometheus/client_model/go"
23+
"google.golang.org/protobuf/proto"
2424
)
2525

2626
func testTextParse(t testing.TB) {

go.mod

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,14 @@ go 1.18
55
require (
66
github.com/alecthomas/kingpin/v2 v2.3.1
77
github.com/go-kit/log v0.2.1
8-
github.com/golang/protobuf v1.5.3
98
github.com/julienschmidt/httprouter v1.3.0
109
github.com/matttproud/golang_protobuf_extensions v1.0.4
1110
github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f
1211
github.com/prometheus/client_golang v1.15.1
13-
github.com/prometheus/client_model v0.3.0
12+
github.com/prometheus/client_model v0.4.0
1413
golang.org/x/net v0.9.0
1514
golang.org/x/oauth2 v0.7.0
15+
google.golang.org/protobuf v1.30.0
1616
gopkg.in/yaml.v2 v2.4.0
1717
)
1818

@@ -21,6 +21,7 @@ require (
2121
github.com/beorn7/perks v1.0.1 // indirect
2222
github.com/cespare/xxhash/v2 v2.2.0 // indirect
2323
github.com/go-logfmt/logfmt v0.5.1 // indirect
24+
github.com/golang/protobuf v1.5.3 // indirect
2425
github.com/jpillora/backoff v1.0.0 // indirect
2526
github.com/prometheus/procfs v0.9.0 // indirect
2627
github.com/rogpeppe/go-internal v1.10.0 // indirect
@@ -29,6 +30,5 @@ require (
2930
golang.org/x/sys v0.7.0 // indirect
3031
golang.org/x/text v0.9.0 // indirect
3132
google.golang.org/appengine v1.6.7 // indirect
32-
google.golang.org/protobuf v1.30.0 // indirect
3333
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
3434
)

go.sum

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@ github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNV
1616
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
1717
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
1818
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
19-
github.com/golang/protobuf v1.3.5/go.mod h1:6O5/vntMXwX2lRkT1hjjk0nAC1IDOTvTlVgjlRvqsdk=
2019
github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk=
2120
github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg=
2221
github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY=
@@ -39,8 +38,8 @@ github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZb
3938
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
4039
github.com/prometheus/client_golang v1.15.1 h1:8tXpTmJbyH5lydzFPoxSIJ0J46jdh3tylbvM1xCv0LI=
4140
github.com/prometheus/client_golang v1.15.1/go.mod h1:e9yaBhRPU2pPNsZwE+JdQl0KEt1N9XgF6zxWmaC0xOk=
42-
github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
43-
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
41+
github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY=
42+
github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU=
4443
github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI=
4544
github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY=
4645
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=

0 commit comments

Comments
 (0)