Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

encoding/csv: confusing about flush #18646

Closed
visaxin opened this issue Jan 13, 2017 · 2 comments
Closed

encoding/csv: confusing about flush #18646

visaxin opened this issue Jan 13, 2017 · 2 comments

Comments

@visaxin
Copy link

visaxin commented Jan 13, 2017

Please answer these questions before submitting your issue. Thanks!

What version of Go are you using (go version)?

1.7.3

What operating system and processor architecture are you using (go env)?

GOARCH="amd64"
GOBIN=""
GOEXE=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOOS="darwin"

What did you do?

fileSink, err := os.OpenFile("./text.txt", os.O_CREATE|os.O_WRONLY|os.O_APPEND, 0655)
	if err != nil {
		return
	}

	csv := csv.NewWriter(fileSink)
	csv.Write([]string{"haha"})
	csv.Flush()
	//fileSink.Sync()
	time.Sleep(time.Minute)

After csv.Flush, the file doesn't Sync.

Shouldn't sync after csv.Flush?

@bradfitz
Copy link
Contributor

Flush only does as is documented:

Flush writes any buffered data to the underlying io.Writer.

If you want to do something else to your *os.File, that's your job.

For questions about Go, see https://golang.org/wiki/Questions.

@visaxin
Copy link
Author

visaxin commented Jan 13, 2017

@bradfitz thanks for your response!

@golang golang locked and limited conversation to collaborators Jan 13, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants