Skip to content

Commit

Permalink
analyzer: add missing cases of options usage
Browse files Browse the repository at this point in the history
  • Loading branch information
catenacyber committed Jan 30, 2025
1 parent 87f7e3c commit 2518a2c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions analyzer/analyzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func (n *perfSprint) run(pass *analysis.Pass) (interface{}, error) {
verb = "%v"
value = call.Args[0]

case calledObj == fmtSprintfObj && len(call.Args) == 1 && n.strFormat.sprintf1:
case calledObj == fmtSprintfObj && len(call.Args) == 1 && n.strFormat.sprintf1 && n.strFormat.enabled:
fn = "fmt.Sprintf"
verb = "%s"
value = call.Args[0]
Expand Down Expand Up @@ -165,7 +165,7 @@ func (n *perfSprint) run(pass *analysis.Pass) (interface{}, error) {

switch verb {
default:
if fn == "fmt.Sprintf" && isConcatable(verb) && n.strFormat.strconcat {
if fn == "fmt.Sprintf" && isConcatable(verb) && n.strFormat.strconcat && n.strFormat.enabled {
break
}
return
Expand Down Expand Up @@ -401,7 +401,7 @@ func (n *perfSprint) run(pass *analysis.Pass) (interface{}, error) {
},
)

case isBasicType(valueType, types.Uint8, types.Uint16, types.Uint32, types.Uint) && oneOf(verb, "%v", "%d", "%x") && n.intFormat.intConv:
case isBasicType(valueType, types.Uint8, types.Uint16, types.Uint32, types.Uint) && oneOf(verb, "%v", "%d", "%x") && n.intFormat.intConv && n.intFormat.enabled:
base := []byte("), 10")
if verb == "%x" {
base = []byte("), 16")
Expand Down

0 comments on commit 2518a2c

Please sign in to comment.