-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Add new linter canonicalheader #4672
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
Conversation
In order for a pull request adding a linter to be reviewed, the linter and the PR must follow some requirements.
Pull Request Description
Linter
The Linter Tests Inside Golangci-lint
|
f69f28e
to
1d2178e
Compare
Canonicalheader checks http header via http.CanonicalHeaderKey().
1d2178e
to
eb4a761
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
canonicalheader analyzes code and reports or fixes non-canonical header key in
net/http.Header
, doc.The linter suggest canonical header:
instead of non-canonical header:
This change also speeds up the code a little, benchmark from repo:
Now, the linter works only with value
net/http.Header
(not pointer) and with string literal.The reason I created this PR:
I tried to add this linter at #4241. But the PR was closed, because duplicate linter (#4241 (comment)).
So this not fully duplicate, SA1008 checks direct write to map.
staticcheck
doesn't want to add checks for methods calls dominikh/go-tools#1519 (comment).