github.com/be-b10g/golangci-lint@v1.17.2/test/testdata/cgo_with_issues/main.go (about)

     1  package cgoexample
     2  
     3  /*
     4  #include <stdio.h>
     5  #include <stdlib.h>
     6  
     7  void myprint(char* s) {
     8  	printf("%s\n", s);
     9  }
    10  */
    11  import "C"
    12  
    13  import (
    14  	"fmt"
    15  	"unsafe"
    16  )
    17  
    18  func Example() {
    19  	cs := C.CString("Hello from stdio\n")
    20  	C.myprint(cs)
    21  	fmt.Printf("bad format %t", cs)
    22  	C.free(unsafe.Pointer(cs))
    23  }