Commit 9087d13e authored by Muhammad Falak R Wani's avatar Muhammad Falak R Wani Committed by Brad Fitzpatrick

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/118915Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
parent a0212aa6
...@@ -75,6 +75,7 @@ func main() { ...@@ -75,6 +75,7 @@ func main() {
if err != nil { if err != nil {
log.Fatal(err) log.Fatal(err)
} }
defer f.Close()
dis, err := f.Disasm() dis, err := f.Disasm()
if err != nil { if err != nil {
...@@ -87,7 +88,6 @@ func main() { ...@@ -87,7 +88,6 @@ func main() {
case 1: case 1:
// disassembly of entire object // disassembly of entire object
dis.Print(os.Stdout, symRE, 0, ^uint64(0), *printCode) dis.Print(os.Stdout, symRE, 0, ^uint64(0), *printCode)
os.Exit(0)
case 3: case 3:
// disassembly of PC range // disassembly of PC range
...@@ -100,6 +100,5 @@ func main() { ...@@ -100,6 +100,5 @@ func main() {
log.Fatalf("invalid end PC: %v", err) log.Fatalf("invalid end PC: %v", err)
} }
dis.Print(os.Stdout, symRE, start, end, *printCode) dis.Print(os.Stdout, symRE, start, end, *printCode)
os.Exit(0)
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment