Golang Memory Allocation Techniques

b:=&bytes.Buffer{}
b.WriteString("A"+"B")
//First strings A and B are allocated. Then new string is passed as an argument to b.WriteString().

Instead use as mentioned below:

b:=&bytes.Buffer{}
b.WriteString("A")
b.WriteString("B")
//In this case no temporary string is created. This reduces bytes allocation in the program.