Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build(deps): bump github.com/catenacyber/perfsprint from 0.7.1 to 0.8.0 #5382

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion .golangci.next.reference.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2243,23 +2243,37 @@ linters-settings:
# still required to have `t.Parallel`, but subtests are allowed to skip it.
# Default: false
ignore-missing-subtests: true

perfsprint:
# Enable/disable optimization of integer formatting.
# Default: true
integer-format: false
# Optimizes even if it requires an int or uint type cast.
# Default: true
int-conversion: false
# Enable/disable optimization of error formatting.
# Default: true
error-format: false
# Optimizes into `err.Error()` even if it is only equivalent for non-nil errors.
# Default: false
err-error: true
# Optimizes `fmt.Errorf`.
# Default: true
errorf: false
# Enable/disable optimization of string formatting.
# Default: true
string-format: false
# Optimizes `fmt.Sprintf` with only one argument.
# Default: true
sprintf1: false
# Optimizes into strings concatenation.
# Default: true
strconcat: false
# Enable/disable optimization of bool formatting.
# Default: true
bool-format: false
# Enable/disable optimization of hex formatting.
# Default: true
hex-format: false

prealloc:
# IMPORTANT: we don't recommend using this linter before doing performance profiling.
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ require (
github.com/breml/errchkjson v0.4.0
github.com/butuzov/ireturn v0.3.1
github.com/butuzov/mirror v1.3.0
github.com/catenacyber/perfsprint v0.7.1
github.com/catenacyber/perfsprint v0.8.0
github.com/charithe/durationcheck v0.0.10
github.com/ckaznocha/intrange v0.3.0
github.com/curioswitch/go-reassign v0.3.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

25 changes: 25 additions & 0 deletions jsonschema/golangci.next.jsonschema.json
Original file line number Diff line number Diff line change
Expand Up @@ -2472,11 +2472,21 @@
"type": "object",
"additionalProperties": false,
"properties": {
"integer-format": {
"description": "Enable/disable optimization of integer formatting.",
"type": "boolean",
"default": true
},
"int-conversion": {
"description": "Optimizes even if it requires an int or uint type cast.",
"type": "boolean",
"default": true
},
"error-format": {
"description": "Enable/disable optimization of error formatting.",
"type": "boolean",
"default": true
},
"err-error": {
"description": "Optimizes into `err.Error()` even if it is only equivalent for non-nil errors.",
"type": "boolean",
Expand All @@ -2487,6 +2497,11 @@
"type": "boolean",
"default": true
},
"string-format": {
"description": "Enable/disable optimization of string formatting.",
"type": "boolean",
"default": true
},
"sprintf1": {
"description": "Optimizes `fmt.Sprintf` with only one argument.",
"type": "boolean",
Expand All @@ -2496,6 +2511,16 @@
"description": "Optimizes into strings concatenation.",
"type": "boolean",
"default": true
},
"bool-format": {
"description": "Enable/disable optimization of bool formatting.",
"type": "boolean",
"default": true
},
"hex-format": {
"description": "Enable/disable optimization of hex formatting.",
"type": "boolean",
"default": true
}
}
},
Expand Down
21 changes: 17 additions & 4 deletions pkg/config/linters_settings.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,16 @@ var defaultLintersSettings = LintersSettings{
AllowUnused: false,
},
PerfSprint: PerfSprintSettings{
IntegerFormat: true,
IntConversion: true,
ErrorFormat: true,
ErrError: false,
ErrorF: true,
StringFormat: true,
SprintF1: true,
StrConcat: true,
BoolFormat: true,
HexFormat: true,
},
Prealloc: PreallocSettings{
Simple: true,
Expand Down Expand Up @@ -791,11 +796,19 @@ type ParallelTestSettings struct {
}

type PerfSprintSettings struct {
IntegerFormat bool `mapstructure:"integer-format"`
IntConversion bool `mapstructure:"int-conversion"`
ErrError bool `mapstructure:"err-error"`
ErrorF bool `mapstructure:"errorf"`
SprintF1 bool `mapstructure:"sprintf1"`
StrConcat bool `mapstructure:"strconcat"`

ErrorFormat bool `mapstructure:"error-format"`
ErrError bool `mapstructure:"err-error"`
ErrorF bool `mapstructure:"errorf"`

StringFormat bool `mapstructure:"string-format"`
SprintF1 bool `mapstructure:"sprintf1"`
StrConcat bool `mapstructure:"strconcat"`

BoolFormat bool `mapstructure:"bool-format"`
HexFormat bool `mapstructure:"hex-format"`
}

type PreallocSettings struct {
Expand Down
8 changes: 8 additions & 0 deletions pkg/golinters/perfsprint/perfsprint.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,19 @@ func New(settings *config.PerfSprintSettings) *goanalysis.Linter {
}

if settings != nil {
cfg[a.Name]["integer-format"] = settings.IntegerFormat
cfg[a.Name]["int-conversion"] = settings.IntConversion

cfg[a.Name]["error-format"] = settings.ErrorFormat
cfg[a.Name]["err-error"] = settings.ErrError
cfg[a.Name]["errorf"] = settings.ErrorF

cfg[a.Name]["string-format"] = settings.StringFormat
cfg[a.Name]["sprintf1"] = settings.SprintF1
cfg[a.Name]["strconcat"] = settings.StrConcat

cfg[a.Name]["bool-format"] = settings.BoolFormat
cfg[a.Name]["hex-format"] = settings.HexFormat
}

return goanalysis.NewLinter(
Expand Down
Loading