Skip to content

Commit

Permalink
[chore]: enable usestdlibvars linter
Browse files Browse the repository at this point in the history
Signed-off-by: Matthieu MOREL <[email protected]>
  • Loading branch information
mmorel-35 committed Nov 24, 2024
1 parent 8b510c3 commit 3794eda
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 7 deletions.
1 change: 1 addition & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ linters:
- unconvert
- unused
- unparam
- usestdlibvars

issues:
# Maximum issues count per one linter.
Expand Down
8 changes: 4 additions & 4 deletions propagation/baggage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ func TestExtractValidBaggageFromHTTPReq(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
req, _ := http.NewRequest("GET", "http://example.com", nil)
req, _ := http.NewRequest(http.MethodGet, "http://example.com", nil)
req.Header.Set("baggage", tt.header)

ctx := context.Background()
Expand Down Expand Up @@ -173,7 +173,7 @@ func TestExtractInvalidDistributedContextFromHTTPReq(t *testing.T) {

for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
req, _ := http.NewRequest("GET", "http://example.com", nil)
req, _ := http.NewRequest(http.MethodGet, "http://example.com", nil)
req.Header.Set("baggage", tt.header)

expected := tt.has.Baggage(t)
Expand Down Expand Up @@ -226,7 +226,7 @@ func TestInjectBaggageToHTTPReq(t *testing.T) {
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
req, _ := http.NewRequest("GET", "http://example.com", nil)
req, _ := http.NewRequest(http.MethodGet, "http://example.com", nil)
ctx := baggage.ContextWithBaggage(context.Background(), tt.mems.Baggage(t))
propagator.Inject(ctx, propagation.HeaderCarrier(req.Header))

Expand Down Expand Up @@ -273,7 +273,7 @@ func TestBaggageInjectExtractRoundtrip(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
b := tt.mems.Baggage(t)
req, _ := http.NewRequest("GET", "http://example.com", nil)
req, _ := http.NewRequest(http.MethodGet, "http://example.com", nil)
ctx := baggage.ContextWithBaggage(context.Background(), b)
propagator.Inject(ctx, propagation.HeaderCarrier(req.Header))

Expand Down
6 changes: 3 additions & 3 deletions propagation/trace_context_benchmark_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,22 +56,22 @@ func BenchmarkExtract(b *testing.B) {

func extractSubBenchmarks(b *testing.B, fn func(*testing.B, *http.Request)) {
b.Run("Sampled", func(b *testing.B) {
req, _ := http.NewRequest("GET", "http://example.com", nil)
req, _ := http.NewRequest(http.MethodGet, "http://example.com", nil)
req.Header.Set("traceparent", "00-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-01")
b.ReportAllocs()

fn(b, req)
})

b.Run("BogusVersion", func(b *testing.B) {
req, _ := http.NewRequest("GET", "http://example.com", nil)
req, _ := http.NewRequest(http.MethodGet, "http://example.com", nil)
req.Header.Set("traceparent", "qw-00000000000000000000000000000000-0000000000000000-01")
b.ReportAllocs()
fn(b, req)
})

b.Run("FutureAdditionalData", func(b *testing.B) {
req, _ := http.NewRequest("GET", "http://example.com", nil)
req, _ := http.NewRequest(http.MethodGet, "http://example.com", nil)
req.Header.Set("traceparent", "02-4bf92f3577b34da6a3ce929d0e0e4736-00f067aa0ba902b7-09-XYZxsf09")
b.ReportAllocs()
fn(b, req)
Expand Down

0 comments on commit 3794eda

Please sign in to comment.