Here's a sample function I want to emulate:
package main
import "fmt"
func main() {
fmt.Println(fmt.Sprintf("Initially I want %d %s", 2, "dogs"))
fmt.Println(Sprintf2("Now I want %d %s", 2, "dogs"))
}
func Sprintf2(format string, a ...interface{}) string {
return fmt.Sprintf(format + " and %d cats", append(a, 5))
}
here's a link in playground: https://play.golang.org/p/dHDwTlbRLDu
expected output:
Initially I want 2 dogs
Now I want 2 dogs and 5 cats
actual output:
Initially I want 2 dogs
Now I want [2 %!d(string=dogs) 5] %!s(MISSING) and %!d(MISSING) cats