Skip to content

Commit

Permalink
Update http_const.go
Browse files Browse the repository at this point in the history
  • Loading branch information
mmorel-35 authored Jun 25, 2024
1 parent eb59e68 commit 320d917
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions internal/checkers/http_const.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ func (checker HTTPConst) Check(_ *analysis.Pass, call *CallMeta) *analysis.Diagn
"HTTPSuccess",
"HTTPSuccessf":

if len(call.Args) < 2 {
return nil
}

if bt, ok := safeTypedBasicLit(call.Args[1], token.STRING); ok {
currentVal := unquoteBasicLitValue(bt)
key := strings.ToUpper(currentVal)
Expand All @@ -46,6 +50,9 @@ func (checker HTTPConst) Check(_ *analysis.Pass, call *CallMeta) *analysis.Diagn
return nil
}
case "HTTPStatusCode", "HTTPStatusCodef":
if len(call.Args) < 5 {
return nil
}
var suggestedFixes []analysis.SuggestedFix
if bt, ok := safeTypedBasicLit(call.Args[1], token.STRING); ok {
currentVal := unquoteBasicLitValue(bt)
Expand Down

0 comments on commit 320d917

Please sign in to comment.