when the file that was opened has been read into buffer, the file should be close.

Signed-off-by: Mabin <bin.ma@huawei.com>
Upstream-commit: d5ea4bae4a15cc9f3c16c046389737682277ff0f
Component: engine
This commit is contained in:
Mabin
2015-02-27 19:09:17 +08:00
parent 2d06b1cf02
commit b67ac7ee80
2 changed files with 5 additions and 10 deletions
@@ -851,14 +851,11 @@ func writeFile(dst, content string, t *testing.T) {
// Return the contents of file at path `src`.
// Call t.Fatal() at the first error (including if the file doesn't exist)
func readFile(src string, t *testing.T) (content string) {
f, err := os.Open(src)
if err != nil {
t.Fatal(err)
}
data, err := ioutil.ReadAll(f)
data, err := ioutil.ReadFile(src)
if err != nil {
t.Fatal(err)
}
return string(data)
}