projects
/
dotfiles
/
.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
history
|
raw
|
HEAD
Giant blob of minor changes
[dotfiles/.git]
/
.config
/
coc
/
extensions
/
coc-go-data
/
tools
/
pkg
/
mod
/
honnef.co
/
go
/
tools@v0.0.1-2020.1.5
/
staticcheck
/
testdata
/
src
/
checkStdlibUsageNilContext
/
checkStdlibUsageNilContext.go
1
package pkg
2
3
import "context"
4
5
func fn1(ctx context.Context) {}
6
func fn2(x string, ctx context.Context) {}
7
func fn4() {}
8
9
type T struct{}
10
11
func (*T) Foo() {}
12
13
func fn3() {
14
fn1(nil) // want `do not pass a nil Context`
15
fn1(context.TODO())
16
fn2("", nil)
17
fn4()
18
19
// don't flag this conversion
20
_ = (func(context.Context))(nil)
21
// and don't crash on these
22
_ = (func())(nil)
23
(*T).Foo(nil)
24
}