1
0
mirror of https://github.com/golang/go synced 2024-11-12 09:00:22 -07:00

cmd/objdump: defer closing the file after opening

Remove the os.Exit(0) to honor the deferred closing of the file.

Change-Id: Iaa9304d8203c8fec0ec728af669a94eadd36905c
Reviewed-on: https://go-review.googlesource.com/118915
Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Muhammad Falak R Wani 2018-06-15 00:07:32 +05:30 committed by Brad Fitzpatrick
parent a0212aa627
commit 9087d13ec3

View File

@ -75,6 +75,7 @@ func main() {
if err != nil {
log.Fatal(err)
}
defer f.Close()
dis, err := f.Disasm()
if err != nil {
@ -87,7 +88,6 @@ func main() {
case 1:
// disassembly of entire object
dis.Print(os.Stdout, symRE, 0, ^uint64(0), *printCode)
os.Exit(0)
case 3:
// disassembly of PC range
@ -100,6 +100,5 @@ func main() {
log.Fatalf("invalid end PC: %v", err)
}
dis.Print(os.Stdout, symRE, start, end, *printCode)
os.Exit(0)
}
}