Skip to content

Commit c5dc773

Browse files
committed
golangci-lint: enable fatcontext and canonicalheader
- fatcontext prevents a problem we had in the past where you keep adding variables to a context canonicalheader has some performance improvements as it doesn't require go to canonize the header on each invocation Those are the only new linters since last we updated
1 parent fd03ba6 commit c5dc773

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

.golangci.yml

+3
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ issues:
1919
# files (due to common repeats and long functions in test code)
2020
- path: _(test|gen)\.go
2121
linters:
22+
- canonicalheader
2223
- cyclop
2324
- dupl
2425
- gocognit
@@ -68,6 +69,7 @@ linters:
6869
- asciicheck
6970
- bidichk
7071
- bodyclose
72+
- canonicalheader
7173
- contextcheck
7274
- cyclop
7375
- dogsled
@@ -79,6 +81,7 @@ linters:
7981
- errorlint
8082
- exhaustive
8183
- exportloopref
84+
- fatcontext
8285
- forbidigo
8386
- forcetypeassert
8487
- funlen

cloudapi/client.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ const (
2020
// MaxRetries specifies max retry attempts
2121
MaxRetries = 3
2222

23-
k6IdempotencyKeyHeader = "k6-Idempotency-Key"
23+
k6IdempotencyKeyHeader = "K6-Idempotency-Key"
2424
)
2525

2626
// Client handles communication with the k6 Cloud API.

cloudapi/logs.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ func (c *Config) logtailConn(ctx context.Context, referenceID string, since time
101101
headers := make(http.Header)
102102
headers.Add("Sec-WebSocket-Protocol", "token="+c.Token.String)
103103
headers.Add("Authorization", "token "+c.Token.String)
104-
headers.Add("X-K6TestRun-Id", referenceID)
104+
headers.Add("X-K6testrun-Id", referenceID)
105105

106106
var conn *websocket.Conn
107107
err = retry(sleeperFunc(time.Sleep), 3, 5*time.Second, 2*time.Minute, func() (err error) {

lib/executor/vu_handle.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ func (vh *vuHandle) runLoopsIfPossible(runIter func(context.Context, lib.ActiveV
225225
// we need to cancel the context, to return the vu
226226
// and because *we* did, lets reinitialize it
227227
cancel()
228-
vh.ctx, vh.cancel = context.WithCancel(vh.parentCtx)
228+
vh.ctx, vh.cancel = context.WithCancel(vh.parentCtx) //nolint:fatcontext // isn't actually on the same context
229229
}
230230
fallthrough // to set the state
231231
case toHardStop:

0 commit comments

Comments
 (0)