github.com/nozzle/golangci-lint@v1.49.0-nz3/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 } 24 25 func notFormattedForGofmt() { 26 } 27 28 func errorForRevive(p *int) error { 29 if p == nil { 30 return nil 31 } else { 32 return nil 33 } 34 } 35