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.
Этот коммит содержится в:
родитель
5a70c88483
коммит
d41f01f003
1 изменённых файлов: 1 добавлений и 5 удалений
|
@ -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)
|
||||
}
|
||||
|
|
Загрузка…
Создание таблицы
Сослаться в новой задаче