mirror of
https://github.com/prometheus/prometheus.git
synced 2024-12-25 05:34:05 -08:00
ci(lint): enable errorlint linter on cmd
Signed-off-by: Matthieu MOREL <matthieu.morel35@gmail.com>
This commit is contained in:
parent
0de7f39e6a
commit
67dcca5005
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
|
@ -142,6 +142,7 @@ jobs:
|
||||||
- name: Install Go
|
- name: Install Go
|
||||||
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
|
||||||
with:
|
with:
|
||||||
|
cache: false
|
||||||
go-version: 1.20.x
|
go-version: 1.20.x
|
||||||
- name: Install snmp_exporter/generator dependencies
|
- name: Install snmp_exporter/generator dependencies
|
||||||
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
|
run: sudo apt-get update && sudo apt-get -y install libsnmp-dev
|
||||||
|
|
|
@ -13,6 +13,7 @@ output:
|
||||||
linters:
|
linters:
|
||||||
enable:
|
enable:
|
||||||
- depguard
|
- depguard
|
||||||
|
- errorlint
|
||||||
- gocritic
|
- gocritic
|
||||||
- gofumpt
|
- gofumpt
|
||||||
- goimports
|
- goimports
|
||||||
|
@ -31,6 +32,27 @@ issues:
|
||||||
- path: _test.go
|
- path: _test.go
|
||||||
linters:
|
linters:
|
||||||
- errcheck
|
- errcheck
|
||||||
|
- path: discovery/
|
||||||
|
linters:
|
||||||
|
- errorlint
|
||||||
|
- path: model/
|
||||||
|
linters:
|
||||||
|
- errorlint
|
||||||
|
- path: scrape/
|
||||||
|
linters:
|
||||||
|
- errorlint
|
||||||
|
- path: storage/
|
||||||
|
linters:
|
||||||
|
- errorlint
|
||||||
|
- path: tsdb/
|
||||||
|
linters:
|
||||||
|
- errorlint
|
||||||
|
- path: util/
|
||||||
|
linters:
|
||||||
|
- errorlint
|
||||||
|
- path: web/
|
||||||
|
linters:
|
||||||
|
- errorlint
|
||||||
|
|
||||||
linters-settings:
|
linters-settings:
|
||||||
depguard:
|
depguard:
|
||||||
|
|
|
@ -498,10 +498,9 @@ func TestDocumentation(t *testing.T) {
|
||||||
cmd.Stdout = &stdout
|
cmd.Stdout = &stdout
|
||||||
|
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
if exitError, ok := err.(*exec.ExitError); ok {
|
var exitError *exec.ExitError
|
||||||
if exitError.ExitCode() != 0 {
|
if errors.As(err, &exitError) && exitError.ExitCode() != 0 {
|
||||||
fmt.Println("Command failed with non-zero exit code")
|
fmt.Println("Command failed with non-zero exit code")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -450,10 +450,9 @@ func TestDocumentation(t *testing.T) {
|
||||||
cmd.Stdout = &stdout
|
cmd.Stdout = &stdout
|
||||||
|
|
||||||
if err := cmd.Run(); err != nil {
|
if err := cmd.Run(); err != nil {
|
||||||
if exitError, ok := err.(*exec.ExitError); ok {
|
var exitError *exec.ExitError
|
||||||
if exitError.ExitCode() != 0 {
|
if errors.As(err, &exitError) && exitError.ExitCode() != 0 {
|
||||||
fmt.Println("Command failed with non-zero exit code")
|
fmt.Println("Command failed with non-zero exit code")
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -241,7 +241,7 @@ func (tg *testGroup) test(evalInterval time.Duration, groupOrderMap map[string]i
|
||||||
g.Eval(suite.Context(), ts)
|
g.Eval(suite.Context(), ts)
|
||||||
for _, r := range g.Rules() {
|
for _, r := range g.Rules() {
|
||||||
if r.LastError() != nil {
|
if r.LastError() != nil {
|
||||||
evalErrs = append(evalErrs, fmt.Errorf(" rule: %s, time: %s, err: %v",
|
evalErrs = append(evalErrs, fmt.Errorf(" rule: %s, time: %s, err: %w",
|
||||||
r.Name(), ts.Sub(time.Unix(0, 0).UTC()), r.LastError()))
|
r.Name(), ts.Sub(time.Unix(0, 0).UTC()), r.LastError()))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue