scripts: close file after error handling

This commit is contained in:
Lars Lehtonen 2019-11-12 09:52:40 -08:00
parent 9afb7b54cb
commit 3c170522f3
No known key found for this signature in database
GPG Key ID: 8137D474EBCB04F2
1 changed files with 1 additions and 1 deletions

View File

@ -53,10 +53,10 @@ func main() {
// Write our generated code to the command/plugin.go file
file, err := os.Create(target)
defer file.Close()
if err != nil {
log.Fatalf("Failed to open %s for writing: %s", target, err)
}
defer file.Close()
_, err = file.WriteString(output)
if err != nil {