build(deps): bump go-simpler.org/sloglint from 0.5.1 to 0.6.0 (#4645)
This commit is contained in:
parent
15c57c176e
commit
7ea621b83a
@ -2014,8 +2014,12 @@ linters-settings:
|
|||||||
# Default: ""
|
# Default: ""
|
||||||
no-global: "all"
|
no-global: "all"
|
||||||
# Enforce using methods that accept a context.
|
# Enforce using methods that accept a context.
|
||||||
# Default: false
|
# Values:
|
||||||
context-only: true
|
# - "": disabled
|
||||||
|
# - "all": report all contextless calls
|
||||||
|
# - "scope": report only if a context exists in the scope of the outermost function
|
||||||
|
# Default: ""
|
||||||
|
context: "all"
|
||||||
# Enforce using static values for log messages.
|
# Enforce using static values for log messages.
|
||||||
# Default: false
|
# Default: false
|
||||||
static-msg: true
|
static-msg: true
|
||||||
|
2
go.mod
2
go.mod
@ -121,7 +121,7 @@ require (
|
|||||||
github.com/ykadowak/zerologlint v0.1.5
|
github.com/ykadowak/zerologlint v0.1.5
|
||||||
gitlab.com/bosi/decorder v0.4.1
|
gitlab.com/bosi/decorder v0.4.1
|
||||||
go-simpler.org/musttag v0.12.1
|
go-simpler.org/musttag v0.12.1
|
||||||
go-simpler.org/sloglint v0.5.1
|
go-simpler.org/sloglint v0.6.0
|
||||||
go.uber.org/automaxprocs v1.5.3
|
go.uber.org/automaxprocs v1.5.3
|
||||||
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc
|
golang.org/x/exp v0.0.0-20240103183307-be819d1f06fc
|
||||||
golang.org/x/tools v0.20.0
|
golang.org/x/tools v0.20.0
|
||||||
|
4
go.sum
generated
4
go.sum
generated
@ -592,8 +592,8 @@ go-simpler.org/assert v0.7.0 h1:OzWWZqfNxt8cLS+MlUp6Tgk1HjPkmgdKBq9qvy8lZsA=
|
|||||||
go-simpler.org/assert v0.7.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28=
|
go-simpler.org/assert v0.7.0/go.mod h1:74Eqh5eI6vCK6Y5l3PI8ZYFXG4Sa+tkr70OIPJAUr28=
|
||||||
go-simpler.org/musttag v0.12.1 h1:yaMcjl/uyVnd1z6GqIhBiFH/PoqNN9f2IgtU7bp7W/0=
|
go-simpler.org/musttag v0.12.1 h1:yaMcjl/uyVnd1z6GqIhBiFH/PoqNN9f2IgtU7bp7W/0=
|
||||||
go-simpler.org/musttag v0.12.1/go.mod h1:46HKu04A3Am9Lne5kKP0ssgwY3AeIlqsDzz3UxKROpY=
|
go-simpler.org/musttag v0.12.1/go.mod h1:46HKu04A3Am9Lne5kKP0ssgwY3AeIlqsDzz3UxKROpY=
|
||||||
go-simpler.org/sloglint v0.5.1 h1:v4b9ave8MidsW28AkkRnF6Syg109zDgsYLiTlB5Ldew=
|
go-simpler.org/sloglint v0.6.0 h1:0YcqSVG7LI9EVBfRPhgPec79BH6X6mwjFuUR5Mr7j1M=
|
||||||
go-simpler.org/sloglint v0.5.1/go.mod h1:+kJJtebtPePWyG5boFwY46COydAggADDOHM22zOvzBk=
|
go-simpler.org/sloglint v0.6.0/go.mod h1:+kJJtebtPePWyG5boFwY46COydAggADDOHM22zOvzBk=
|
||||||
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
go.opencensus.io v0.21.0/go.mod h1:mSImk1erAIZhrmZN+AvHh14ztQfjbGwt4TtuofqLduU=
|
||||||
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
go.opencensus.io v0.22.0/go.mod h1:+kGneAE2xo2IficOXnaByMWTGM9T73dGwxeWcUqIpI8=
|
||||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
||||||
|
@ -2289,10 +2289,10 @@
|
|||||||
"type": "boolean",
|
"type": "boolean",
|
||||||
"default": true
|
"default": true
|
||||||
},
|
},
|
||||||
"context-only": {
|
"context": {
|
||||||
"description": "Enforce using methods that accept a context.",
|
"description": "Enforce using methods that accept a context.",
|
||||||
"type": "boolean",
|
"enum": ["", "all", "scope"],
|
||||||
"default": false
|
"default": ""
|
||||||
},
|
},
|
||||||
"static-msg": {
|
"static-msg": {
|
||||||
"description": "Enforce using static values for log messages.",
|
"description": "Enforce using static values for log messages.",
|
||||||
|
@ -144,6 +144,8 @@ var defaultLintersSettings = LintersSettings{
|
|||||||
NoMixedArgs: true,
|
NoMixedArgs: true,
|
||||||
KVOnly: false,
|
KVOnly: false,
|
||||||
AttrOnly: false,
|
AttrOnly: false,
|
||||||
|
NoGlobal: "",
|
||||||
|
Context: "",
|
||||||
ContextOnly: false,
|
ContextOnly: false,
|
||||||
StaticMsg: false,
|
StaticMsg: false,
|
||||||
NoRawKeys: false,
|
NoRawKeys: false,
|
||||||
@ -810,9 +812,10 @@ type RowsErrCheckSettings struct {
|
|||||||
type SlogLintSettings struct {
|
type SlogLintSettings struct {
|
||||||
NoMixedArgs bool `mapstructure:"no-mixed-args"`
|
NoMixedArgs bool `mapstructure:"no-mixed-args"`
|
||||||
KVOnly bool `mapstructure:"kv-only"`
|
KVOnly bool `mapstructure:"kv-only"`
|
||||||
NoGlobal string `mapstructure:"no-global"`
|
|
||||||
AttrOnly bool `mapstructure:"attr-only"`
|
AttrOnly bool `mapstructure:"attr-only"`
|
||||||
ContextOnly bool `mapstructure:"context-only"`
|
NoGlobal string `mapstructure:"no-global"`
|
||||||
|
Context string `mapstructure:"context"`
|
||||||
|
ContextOnly bool `mapstructure:"context-only"` // Deprecated: use Context instead.
|
||||||
StaticMsg bool `mapstructure:"static-msg"`
|
StaticMsg bool `mapstructure:"static-msg"`
|
||||||
NoRawKeys bool `mapstructure:"no-raw-keys"`
|
NoRawKeys bool `mapstructure:"no-raw-keys"`
|
||||||
KeyNamingCase string `mapstructure:"key-naming-case"`
|
KeyNamingCase string `mapstructure:"key-naming-case"`
|
||||||
|
@ -408,6 +408,14 @@ func (l *Loader) handleLinterOptionDeprecations() {
|
|||||||
if l.cfg.LintersSettings.Stylecheck.GoVersion != "" {
|
if l.cfg.LintersSettings.Stylecheck.GoVersion != "" {
|
||||||
l.log.Warnf("The configuration option `linters.stylecheck.go` is deprecated, please use global `run.go`.")
|
l.log.Warnf("The configuration option `linters.stylecheck.go` is deprecated, please use global `run.go`.")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deprecated since v1.58.0
|
||||||
|
if l.cfg.LintersSettings.SlogLint.ContextOnly {
|
||||||
|
l.log.Warnf("The configuration option `linters.sloglint.context-only` is deprecated, please use `linters.sloglint.context`")
|
||||||
|
if l.cfg.LintersSettings.SlogLint.Context == "" {
|
||||||
|
l.cfg.LintersSettings.SlogLint.Context = "all"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (l *Loader) handleEnableOnlyOption() error {
|
func (l *Loader) handleEnableOnlyOption() error {
|
||||||
|
@ -14,9 +14,9 @@ func New(settings *config.SlogLintSettings) *goanalysis.Linter {
|
|||||||
opts = &sloglint.Options{
|
opts = &sloglint.Options{
|
||||||
NoMixedArgs: settings.NoMixedArgs,
|
NoMixedArgs: settings.NoMixedArgs,
|
||||||
KVOnly: settings.KVOnly,
|
KVOnly: settings.KVOnly,
|
||||||
NoGlobal: settings.NoGlobal,
|
|
||||||
AttrOnly: settings.AttrOnly,
|
AttrOnly: settings.AttrOnly,
|
||||||
ContextOnly: settings.ContextOnly,
|
NoGlobal: settings.NoGlobal,
|
||||||
|
ContextOnly: settings.Context,
|
||||||
StaticMsg: settings.StaticMsg,
|
StaticMsg: settings.StaticMsg,
|
||||||
NoRawKeys: settings.NoRawKeys,
|
NoRawKeys: settings.NoRawKeys,
|
||||||
KeyNamingCase: settings.KeyNamingCase,
|
KeyNamingCase: settings.KeyNamingCase,
|
||||||
|
@ -12,5 +12,5 @@ import (
|
|||||||
func test() {
|
func test() {
|
||||||
slog.InfoContext(context.Background(), "msg")
|
slog.InfoContext(context.Background(), "msg")
|
||||||
|
|
||||||
slog.Info("msg") // want `methods without a context should not be used`
|
slog.Info("msg") // want `InfoContext should be used instead`
|
||||||
}
|
}
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
linters-settings:
|
linters-settings:
|
||||||
sloglint:
|
sloglint:
|
||||||
context-only: true
|
context: "all"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user