github.com/serversong/goreporter@v0.0.0-20200325104552-3cfaf44fd178/linters/golint/testdata/context.go (about) 1 // Test that context.Context is the first arg to a function. 2 3 // Package foo ... 4 package foo 5 6 import ( 7 "context" 8 ) 9 10 // A proper context.Context location 11 func x(ctx context.Context) { // ok 12 } 13 14 // A proper context.Context location 15 func x(ctx context.Context, s string) { // ok 16 } 17 18 // An invalid context.Context location 19 func y(s string, ctx context.Context) { // MATCH /context.Context should be the first parameter.*/ 20 } 21 22 // An invalid context.Context location with more than 2 args 23 func y(s string, r int, ctx context.Context, x int) { // MATCH /context.Context should be the first parameter.*/ 24 }