Which would be faster?
data := fmt.Sprintf("{\"TEST\":3, \"ID\":\"%s\"}", Id)
OR json marshalling a struct like that?
Which would be faster?
data := fmt.Sprintf("{\"TEST\":3, \"ID\":\"%s\"}", Id)
OR json marshalling a struct like that?
Highly depends on what you're trying to do, you should benchmark it and see.
However for your very specific example, the fastest way is just use basic string concat like :
data := `{"TEST":3, "ID":"` + Id + `"}`