Skip to content

Commit

Permalink
feat: add "StatusCode" as const
Browse files Browse the repository at this point in the history
  • Loading branch information
sashamelentyev committed Aug 8, 2022
1 parent 201e60b commit c8058cc
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions pkg/analyzer/analyzer.go
Expand Up @@ -24,6 +24,8 @@ const (
DefaultRPCPathFlag = "default-rpc-path"
)

const statusCode = "StatusCode"

// New returns new usestdlibvars analyzer.
func New() *analysis.Analyzer {
return &analysis.Analyzer{
Expand Down Expand Up @@ -153,7 +155,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
return
}

if basicLit := getBasicLitFromElts(n.Elts, "StatusCode"); basicLit != nil {
if basicLit := getBasicLitFromElts(n.Elts, statusCode); basicLit != nil {
checkHTTPStatusCode(pass, basicLit)
}
}
Expand All @@ -170,7 +172,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
return
}

if selectorExpr.Sel.Name != "StatusCode" {
if selectorExpr.Sel.Name != statusCode {
return
}

Expand Down

0 comments on commit c8058cc

Please sign in to comment.