When using printf, the format string is better to be a string literal and not a variable. And C.CString is coverted char pointer by go runtime. And also you may not use variadic arguments of printf in latest go. In other case, if you want to remove the warnings, Use type cast:
package main
/*
typedef const char* const_char_ptr;
#include <stdio.h>
*/
import "C"
func main() {
C.puts((C.const_char_ptr)(C.CString("foo")))
}
EDIT
Note that call free for C.CString.
package main
/*
typedef const char* const_char_ptr;
#include <stdio.h>
*/
import "C"
import "unsafe"
func main() {
ptr := (C.const_char_ptr)(C.CString("foo"))
defer C.free(unsafe.Pointer(ptr))
C.puts(ptr)
}