Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
kkHAIKE committed Sep 27, 2022
1 parent 33f38d4 commit e8d0ad2
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions testdata/src/a/a.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,12 @@ func f9(w http.ResponseWriter, r *http.Request) {

func f10(in bool, w http.ResponseWriter, r *http.Request) {
f8(r.Context(), w, r)
f8(context.Background(), w, r)
f8(context.Background(), w, r) // want "Non-inherited new context, use function like `context.WithXXX` or `r.Context` instead"
}

// nolint: contextcheck
func f14(w http.ResponseWriter, r *http.Request, err error) {
f8(r.Context(), w, r)
f8(context.Background(), w, r)
}

// @contextcheck(req_has_ctx)
Expand All @@ -126,9 +126,7 @@ func f11() {

f9(w, r)

// f10 should be like `func f10(ctx context.Context, in bool, w http.ResponseWriter, r *http.Request)`
f10(true, w, r) // want "Function `f10` should pass the context parameter"

f10(true, w, r)
f14(w, r, nil)
f15(w, r, nil)
})
Expand Down

0 comments on commit e8d0ad2

Please sign in to comment.