Merge pull request #8363 from alrs/scripts-plugins-err-before-close

scripts: close file after error handling
This commit is contained in:
Megan Marsh 2019-11-12 10:21:54 -08:00 committed by GitHub
commit ffc4876812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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 {