.gitignore added
[dotfiles/.git] / .config / coc / extensions / coc-go-data / tools / pkg / mod / golang.org / x / tools@v0.1.1-0.20210319172145-bda8f5cee399 / go / callgraph / cha / testdata / func.go
diff --git a/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.1.1-0.20210319172145-bda8f5cee399/go/callgraph/cha/testdata/func.go b/.config/coc/extensions/coc-go-data/tools/pkg/mod/golang.org/x/tools@v0.1.1-0.20210319172145-bda8f5cee399/go/callgraph/cha/testdata/func.go
new file mode 100644 (file)
index 0000000..a12f3f1
--- /dev/null
@@ -0,0 +1,23 @@
+// +build ignore
+
+package main
+
+// Test of dynamic function calls; no interfaces.
+
+func A(int) {}
+
+var (
+       B = func(int) {}
+       C = func(int) {}
+)
+
+func f() {
+       pfn := B
+       pfn(0) // calls A, B, C, even though A is not even address-taken
+}
+
+// WANT:
+// Dynamic calls
+//   f --> A
+//   f --> init$1
+//   f --> init$2