Skip to content

Commit

Permalink
Merge pull request #41 from sashamelentyev/feat/status-code-as-const
Browse files Browse the repository at this point in the history
feat: add "StatusCode" as const
  • Loading branch information
sashamelentyev committed Aug 8, 2022
2 parents 201e60b + c8058cc commit 8caaf87
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 8caaf87

Please sign in to comment.