Last active
January 15, 2016 12:04
-
-
Save kaneshin/71ef4a2488959fc2c810 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package foo | |
import ( | |
"bytes" | |
"encoding/json" | |
"fmt" | |
) | |
func buildArrayBodyVerKojima(v []interface{}) string { | |
var str string | |
for _, j := range v { | |
jsonByte, _ := json.Marshal(j) | |
str = fmt.Sprintf("%s%s\n", str, string(jsonByte)) | |
} | |
return str | |
} | |
func buildArrayBodyVerKaneshin(v []interface{}) string { | |
var buf bytes.Buffer | |
for _, j := range v { | |
jsonByte, _ := json.Marshal(j) | |
buf.Write(jsonByte) | |
buf.WriteString("\n") | |
} | |
return buf.String() | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment