1
0
mirror of https://github.com/golang/go synced 2024-11-23 06:50:05 -07:00

cmd/go: in tests, add sync before closing file in copyFile helper

An experiment to see if this helps flakiness go away in
TestExecutableGOROOT.

Updates #37306

Change-Id: I2f4f63bdb507359ca07267d86cdb41fe4968f151
Reviewed-on: https://go-review.googlesource.com/c/go/+/220317
Run-TryBot: Michael Matloob <matloob@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Bryan C. Mills <bcmills@google.com>
This commit is contained in:
Michael Matloob 2020-02-20 12:53:32 -05:00
parent 75ea964b3f
commit 6396bc9df7

View File

@ -2454,11 +2454,15 @@ func copyFile(src, dst string, perm os.FileMode) error {
}
_, err = io.Copy(df, sf)
err2 := df.Close()
err2 := df.Sync()
err3 := df.Close()
if err != nil {
return err
}
return err2
if err2 != nil {
return err2
}
return err3
}
// TestExecutableGOROOT verifies that the cmd/go binary itself uses