Enable goimports linter
Some checks failed
golangci-lint / lint (push) Has been cancelled

Enable `goimports` golangci-lint linter and fix issues.

Signed-off-by: Ben Kochie <superq@gmail.com>
This commit is contained in:
Ben Kochie 2024-11-10 11:58:03 +01:00 committed by Johannes 'fish' Ziemke
parent 983e6345d5
commit ff97e35a71
7 changed files with 14 additions and 16 deletions

View File

@ -1,17 +1,9 @@
linters: linters:
enable: enable:
- depguard - depguard
- goimports
- misspell - misspell
- revive - revive
disable:
# Disable soon to deprecated[1] linters that lead to false
# positives when build tags disable certain files[2]
# 1: https://github.com/golangci/golangci-lint/issues/1841
# 2: https://github.com/prometheus/node_exporter/issues/1545
- deadcode
- unused
- structcheck
- varcheck
issues: issues:
exclude-rules: exclude-rules:

View File

@ -18,10 +18,11 @@ package collector
import ( import (
"fmt" "fmt"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs/sysfs"
"log/slog" "log/slog"
"strings" "strings"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs/sysfs"
) )
type cpuFreqCollector struct { type cpuFreqCollector struct {

View File

@ -18,9 +18,10 @@
package collector package collector
import ( import (
"log/slog"
"github.com/alecthomas/kingpin/v2" "github.com/alecthomas/kingpin/v2"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"log/slog"
) )
type interruptsCollector struct { type interruptsCollector struct {

View File

@ -17,10 +17,11 @@
package collector package collector
import ( import (
"log/slog"
"github.com/alecthomas/kingpin/v2" "github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/go-runit/runit" "github.com/prometheus-community/go-runit/runit"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"log/slog"
) )
var runitServiceDir = kingpin.Flag("collector.runit.servicedir", "Path to runit service directory.").Default("/etc/service").String() var runitServiceDir = kingpin.Flag("collector.runit.servicedir", "Path to runit service directory.").Default("/etc/service").String()

View File

@ -17,9 +17,10 @@
package collector package collector
import ( import (
"log/slog"
"github.com/opencontainers/selinux/go-selinux" "github.com/opencontainers/selinux/go-selinux"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"log/slog"
) )
type selinuxCollector struct { type selinuxCollector struct {

View File

@ -18,9 +18,10 @@ package collector
import ( import (
"fmt" "fmt"
"log/slog"
"github.com/prometheus/client_golang/prometheus" "github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs" "github.com/prometheus/procfs"
"log/slog"
) )
type softirqsCollector struct { type softirqsCollector struct {

View File

@ -18,8 +18,9 @@
package collector package collector
import ( import (
"github.com/prometheus/client_golang/prometheus"
"log/slog" "log/slog"
"github.com/prometheus/client_golang/prometheus"
) )
var unameDesc = prometheus.NewDesc( var unameDesc = prometheus.NewDesc(