How to Efficiently Concatenate Strings in Go 7种拼接方式 String Concat 1 str += "hello-world" String Sprintf 1 str = fmt.Sprintf("%s%s", str, "hello-world") String Join 1 str = strings.Join([]string{str, "hello-world"}, "") Buffer Write 1 2 3 buf := new(bytes.Buffer) buf.WriteString("hello-world") str := buf.String() Bytes Append 1 2 3 4 var b []byte s := "hello-world" b = append(b, s...) str := string(b) String Copy 1 2