Giant blob of minor changes
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.0.0-20201028153306-37f0764111ff / go / analysis / passes / lostcancel / testdata / src / b / b.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201028153306-37f0764111ff/go/analysis/passes/lostcancel/testdata/src/b/b.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.0.0-20201028153306-37f0764111ff/go/analysis/passes/lostcancel/testdata/src/b/b.go
new file mode 100644 (file)
index 0000000..18ef034
--- /dev/null
@@ -0,0 +1,26 @@
+// Copyright 2018 The Go Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style
+// license that can be found in the LICENSE file.
+
+package main
+
+import "context"
+
+// Return from main is handled specially.
+// Since the program exits, there's no need to call cancel.
+func main() {
+       _, cancel := context.WithCancel(nil)
+       if maybe {
+               cancel()
+       }
+}
+
+func notMain() {
+       _, cancel := context.WithCancel(nil) // want "cancel function.*not used"
+
+       if maybe {
+               cancel()
+       }
+} // want "return statement.*reached without using the cancel"
+
+var maybe bool