package file import ( "encoding/json" "testing" ) func TestWriteFile(t *testing.T) { fPath := "./test" data := []byte{} aData, _ := json.Marshal("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\\n") for i := 0; i < 10000000; i++ { data = append(data, aData...) } t.Log("finished", len(data)) err := WriteFile(fPath, data, 0700) if err != nil { t.Error(err) } }