-
Hello, community. I want to set the severity into the nilaway lint plugin for print error with info message and make it not return an error but the severity is not forcing to info message Because I'm working on a large project that contained a lot of nil potential errors, I want to force it into an info message to encourage my colleague to fix this. I don't want to break my CI it will block my development processes. Does anyone know how it is configured? examples: custom-gcl.yml version: v1.57.2
name: golangci-lint
destination: bin
plugins:
- module: go.uber.org/nilaway
import: go.uber.org/nilaway/cmd/gclplugin
version: latest .golangci.yml linters:
enable:
- nilaway
linters-settings:
custom:
nilaway:
type: module
description: Static analysis tool to detect potential nil panics in Go code.
settings:
# Settings must be a "map from string to string" to mimic command line flags: the keys are
# flag names and the values are the values to the particular flags.
include-pkgs: some-package.com/my-package
severity:
default-severity: error
rules:
- linters:
- nilaway
severity: info |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hello, Your configuration works as expected: $ ./bin/golangci-lint run --out-format json | jq '.Issues[] | {linter: .FromLinter, text: .Text, severity: .Severity }'
{
"linter": "nilaway",
"text": "\u001b[31merror: \u001b[0mPotential nil panic detected. Observed nil flow from source to dereference point: \n\t- sandbox/foo.go:29:9: unassigned variable \u001b[95m`v`\u001b[0m dereferenced\n",
"severity": "info"
} As you can see nilway reports are using The beginning of the message ( |
Beta Was this translation helpful? Give feedback.
Hello,
Your configuration works as expected:
As you can see nilway reports are using
info
as severity.The beginning of the message (
\u001b[31merror: \u001b[0m
) is coming from nilway itself.https://github.com/uber-go/nilaway/blob/8ff8105b59f17f02e8c2eb1e4dfafbcff3b23873/util/util.go#L441-L453