1
0
mirror of https://github.com/mgechev/revive.git synced 2025-01-10 03:17:11 +02:00
revive/fixtures/context-arguments.go
2018-01-25 11:34:38 -08:00

25 lines
620 B
Go

// Test that context.Context is the first arg to a function.
// Package foo ...
package foo
import (
"context"
)
// A proper context.Context location
func x(ctx context.Context) { // ok
}
// A proper context.Context location
func x(ctx context.Context, s string) { // ok
}
// An invalid context.Context location
func y(s string, ctx context.Context) { // MATCH /context.Context should be the first parameter of a function/
}
// An invalid context.Context location with more than 2 args
func y(s string, r int, ctx context.Context, x int) { // MATCH /context.Context should be the first parameter of a function/
}