.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.1.1-0.20210319172145-bda8f5cee399 / go / analysis / passes / cgocall / testdata / src / b / b.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.1.1-0.20210319172145-bda8f5cee399/go/analysis/passes/cgocall/testdata/src/b/b.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.1.1-0.20210319172145-bda8f5cee399/go/analysis/passes/cgocall/testdata/src/b/b.go
new file mode 100644 (file)
index 0000000..ff2f2e1
--- /dev/null
@@ -0,0 +1,20 @@
+// Copyright 2017 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.
+
+// Test the cgo checker on a file that doesn't use cgo, but has an
+// import named "C".
+
+package b
+
+import C "fmt"
+
+import "unsafe"
+
+func init() {
+       var f func()
+       C.Println(unsafe.Pointer(&f))
+
+       // Passing a pointer (via a slice), but C is fmt, not cgo.
+       C.Println([]int{3})
+}