golangci-lint/test/testdata/sloglint_no_raw_keys.go
2023-10-19 12:42:40 +02:00

22 lines
462 B
Go

//go:build go1.21
//golangcitest:args -Esloglint
//golangcitest:config_path testdata/configs/sloglint_no_raw_keys.yml
package testdata
import "log/slog"
const foo = "foo"
func Foo(value int) slog.Attr {
return slog.Int("foo", value)
}
func test() {
slog.Info("msg", foo, 1)
slog.Info("msg", Foo(1))
slog.Info("msg", "foo", 1) // want `raw keys should not be used`
slog.Info("msg", slog.Int("foo", 1)) // want `raw keys should not be used`
}