main: avoid leaving files open

Eventually, open files should be closed when the GC runs and the
finalizer is called. However we shouldn't rely on that.

Using `ioutil.ReadFile` as it's a simpler pattern anyway.
Этот коммит содержится в:
Ayke van Laethem 2019-12-21 20:09:34 +01:00 коммит произвёл Ron Evans
родитель 5a70c88483
коммит d41f01f003

Просмотреть файл

@ -114,11 +114,7 @@ func runTest(path, target string, t *testing.T) {
if path[len(path)-1] == os.PathSeparator {
txtpath = path + "out.txt"
}
f, err := os.Open(txtpath)
if err != nil {
t.Fatal("could not open expected output file:", err)
}
expected, err := ioutil.ReadAll(f)
expected, err := ioutil.ReadFile(txtpath)
if err != nil {
t.Fatal("could not read expected output file:", err)
}