-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
http related false positives after "skip import check" commit #7
Comments
plz add more code to me for test 😊 |
Can do later. In the meantime, can you confirm that the intent is not to warn about the cases above, i.e. when a |
this case is not false-positive in current design. 😊 cuz http.Request can't determine whether it is server side, so i focus on the func sign only: u can change these underlying function sign that add Context paramter like this: eg: func someHandler(w http.ResponseWriter, r *http.Request) {
ctx := r.Context()
if err := doAnyThine(ctx, w, r); err != nil {
writeProblemResponse(ctx, w, r, err)
}
} |
I considered changing the signatures already, but doing so would be possibly misleading and just to appease contextcheck, so I decided against it. Would it not be ok to change the logic here so that if a function takes both |
i think increase the HandlerFunc sign range may get more false-positive. maybe have proxy case? (req is a client side, copy resp to W) so i add a nolint comment 7be313c for skip false-positive case. i think it's a necessary feature. 😊 u can add |
For my use case the addition of In absence of changing the default/builtin behavior, I would find useful an option (command line one as well as one that can be set by golangci-lint internally) that would make contextcheck not issue any warnings for functions that take a |
new version can mark it automatically.
|
After commit a2c3e11, v1.0.8, I'm getting reports that I think are false positives.
There's an underlying function
...which calls
r.Context()
, and another function that calls it (but notr.Context()
directly) likeNow, every
WriteProblem
andwriteProblemResponse
call gets flagged as "should pass the context parameter". I suppose the intent is not to do that.r.Context()
is used where aContext
can be used.v1.0.7 did not have this problem.
Also, for reasons I cannot explain, I'm also seeing this problem with golangci-lint v1.49.0, which uses contextcheck v1.0.6. But I cannot replicate the problem with contextcheck v1.0.6 directly 🤔
The text was updated successfully, but these errors were encountered: