Skip to content

Commit 8caaf87

Browse files
Merge pull request #41 from sashamelentyev/feat/status-code-as-const
feat: add "StatusCode" as const
2 parents 201e60b + c8058cc commit 8caaf87

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

pkg/analyzer/analyzer.go

+4-2
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ const (
2424
DefaultRPCPathFlag = "default-rpc-path"
2525
)
2626

27+
const statusCode = "StatusCode"
28+
2729
// New returns new usestdlibvars analyzer.
2830
func New() *analysis.Analyzer {
2931
return &analysis.Analyzer{
@@ -153,7 +155,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
153155
return
154156
}
155157

156-
if basicLit := getBasicLitFromElts(n.Elts, "StatusCode"); basicLit != nil {
158+
if basicLit := getBasicLitFromElts(n.Elts, statusCode); basicLit != nil {
157159
checkHTTPStatusCode(pass, basicLit)
158160
}
159161
}
@@ -170,7 +172,7 @@ func run(pass *analysis.Pass) (interface{}, error) {
170172
return
171173
}
172174

173-
if selectorExpr.Sel.Name != "StatusCode" {
175+
if selectorExpr.Sel.Name != statusCode {
174176
return
175177
}
176178

0 commit comments

Comments
 (0)