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

[chore]: enable usestdlibvars linter #6001

Merged
merged 2 commits into from
Nov 25, 2024
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
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
Loading
Loading