Skip to content

Commit

Permalink
fix: fix issue timakin#11
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeShpak committed Apr 19, 2023
1 parent e39cf3f commit f7423e8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions passes/bodyclose/bodyclose.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,6 +218,10 @@ func (r *runner) getResVal(instr ssa.Instruction) (ssa.Value, bool) {
if instr.Type().String() == r.resTyp.String() {
return instr, true
}
case *ssa.Store:
if instr.Val.Type().String() == r.resTyp.String() {
return instr.Val, true
}
}
return nil, false
}
Expand Down
15 changes: 15 additions & 0 deletions passes/bodyclose/testdata/src/a/issue47.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package a

import (
"io"
"net/http/httptest"
)

func issues11() {
w := httptest.NewRecorder()
resp := w.Result()
defer func() {
_ = resp.Body.Close()
}()
_, _ = io.ReadAll(resp.Body)
}

0 comments on commit f7423e8

Please sign in to comment.