Go — variadic functions parameters pass-through


I’m trying to write a simple fmt.Fprintf wrapper which takes a variable number of arguments. This is the code:

func Die(format string, args ...interface{}) {
    str := fmt.Sprintf(format, args)
    fmt.Fprintf(os.Stderr, "%v\n", str)


When I call it with Die("foo") , I get the following output (instead of " foo "):

foo%!(EXTRA []interface {}=[])

  • Why is there " %!(EXTRA []interface {}=[]) " after the " foo "?
  • What is the correct way to create wrappers around fmt.Fprintf ?