aboutsummaryrefslogtreecommitdiff
path: root/gopls/internal/lsp/testdata/cgo/declarecgo.go
diff options
context:
space:
mode:
Diffstat (limited to 'gopls/internal/lsp/testdata/cgo/declarecgo.go')
-rw-r--r--gopls/internal/lsp/testdata/cgo/declarecgo.go27
1 files changed, 27 insertions, 0 deletions
diff --git a/gopls/internal/lsp/testdata/cgo/declarecgo.go b/gopls/internal/lsp/testdata/cgo/declarecgo.go
new file mode 100644
index 000000000..c283cdfb2
--- /dev/null
+++ b/gopls/internal/lsp/testdata/cgo/declarecgo.go
@@ -0,0 +1,27 @@
+package cgo
+
+/*
+#include <stdio.h>
+#include <stdlib.h>
+
+void myprint(char* s) {
+ printf("%s\n", s);
+}
+*/
+import "C"
+
+import (
+ "fmt"
+ "unsafe"
+)
+
+func Example() { //@mark(funccgoexample, "Example"),item(funccgoexample, "Example", "func()", "func")
+ fmt.Println()
+ cs := C.CString("Hello from stdio\n")
+ C.myprint(cs)
+ C.free(unsafe.Pointer(cs))
+}
+
+func _() {
+ Example() //@godef("ample", funccgoexample),complete("ample", funccgoexample)
+}