Merge pull request #244 from robbix1206/Example_Close_File
Close the file after read
This commit is contained in:
commit
1acc7dc017
1 changed files with 4 additions and 0 deletions
|
@ -131,6 +131,10 @@ func loadSound() error {
|
|||
|
||||
// If this is the end of the file, just return.
|
||||
if err == io.EOF || err == io.ErrUnexpectedEOF {
|
||||
file.Close()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue