Skip to content

Commit

Permalink
cmd/go: fix file leak in TestBuildmodePIE
Browse files Browse the repository at this point in the history
Change-Id: Ifeb93f6dc75fb5f90d595211fb0f97a89bf74526
Reviewed-on: https://go-review.googlesource.com/64530
Reviewed-by: Dave Cheney <dave@cheney.net>
Run-TryBot: Dave Cheney <dave@cheney.net>
TryBot-Result: Gobot Gobot <gobot@golang.org>
  • Loading branch information
hirochachacha authored and davecheney committed Sep 19, 2017
1 parent c40579a commit 0bbb666
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/cmd/go/go_test.go
Expand Up @@ -4474,6 +4474,7 @@ func TestBuildmodePIE(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer f.Close()
if f.Type != elf.ET_DYN { if f.Type != elf.ET_DYN {
t.Errorf("PIE type must be ET_DYN, but %s", f.Type) t.Errorf("PIE type must be ET_DYN, but %s", f.Type)
} }
Expand All @@ -4482,6 +4483,7 @@ func TestBuildmodePIE(t *testing.T) {
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
defer f.Close()
if f.Flags&macho.FlagDyldLink == 0 { if f.Flags&macho.FlagDyldLink == 0 {
t.Error("PIE must have DyldLink flag, but not") t.Error("PIE must have DyldLink flag, but not")
} }
Expand Down

0 comments on commit 0bbb666

Please sign in to comment.