-
Notifications
You must be signed in to change notification settings - Fork 326
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
gapit: Add OutputCSV flag to benchmark (#2540). #2573
Conversation
This flag produces a single row of comma-separated data. Also, all time information is expressed in milliseconds.
cmd/gapit/benchmark.go
Outdated
w.Flush() | ||
if verb.OutputCSV { | ||
csvWriter := csv.NewWriter(os.Stdout) | ||
defer csvWriter.Flush() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Defer is a bit funny (and you probably don't actually want it here) but defer actually defers until the end of the current function (NOT the scope-block).
How I typically handle this is:
if verb.OutputCSV {
func() {
csvWriter....
defer csvwriter.Flush()
....
....
} ()
} else {
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah! Ok, didn't know that. Will change it and resubmit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is super subtle, and goes completely against all of my past experience (thanks Go)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One small nit about defer, and the presubmit is failing, other than that, looks good to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please make sure to squash before commit.
This flag produces a single row of comma-separated data.
Also, all time information is expressed in milliseconds.