scripts: close file after error handling
This commit is contained in:
parent
9afb7b54cb
commit
3c170522f3
|
@ -53,10 +53,10 @@ func main() {
|
||||||
|
|
||||||
// Write our generated code to the command/plugin.go file
|
// Write our generated code to the command/plugin.go file
|
||||||
file, err := os.Create(target)
|
file, err := os.Create(target)
|
||||||
defer file.Close()
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Fatalf("Failed to open %s for writing: %s", target, err)
|
log.Fatalf("Failed to open %s for writing: %s", target, err)
|
||||||
}
|
}
|
||||||
|
defer file.Close()
|
||||||
|
|
||||||
_, err = file.WriteString(output)
|
_, err = file.WriteString(output)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue