|
|
|
|
|
by timewasted
4817 days ago
|
|
Getting files closed on errors should look something like: file, err := os.Open(filename)
if err != nil {
// handle the error however you see fit
}
defer file.Close()
// continue working, knowing that file.Close() will be called when the surrounding function returns
See: http://golang.org/doc/effective_go.html#defer |
|