Skip to content

Commit

Permalink
Enable goimports linter
Browse files Browse the repository at this point in the history
Enable `goimports` golangci-lint linter and fix issues.

Signed-off-by: Ben Kochie <[email protected]>
  • Loading branch information
SuperQ committed Nov 10, 2024
1 parent 0fddfd1 commit 16e2a50
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 16 deletions.
10 changes: 1 addition & 9 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
linters:
enable:
- depguard
- goimports
- misspell
- 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:
exclude-rules:
Expand Down
5 changes: 3 additions & 2 deletions collector/cpufreq_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,11 @@ package collector

import (
"fmt"
"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs/sysfs"
"log/slog"
"strings"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs/sysfs"
)

type cpuFreqCollector struct {
Expand Down
3 changes: 2 additions & 1 deletion collector/interrupts_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@
package collector

import (
"log/slog"

"github.com/alecthomas/kingpin/v2"
"github.com/prometheus/client_golang/prometheus"
"log/slog"
)

type interruptsCollector struct {
Expand Down
3 changes: 2 additions & 1 deletion collector/runit.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
package collector

import (
"log/slog"

"github.com/alecthomas/kingpin/v2"
"github.com/prometheus-community/go-runit/runit"
"github.com/prometheus/client_golang/prometheus"
"log/slog"
)

var runitServiceDir = kingpin.Flag("collector.runit.servicedir", "Path to runit service directory.").Default("/etc/service").String()
Expand Down
3 changes: 2 additions & 1 deletion collector/selinux_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@
package collector

import (
"log/slog"

"github.com/opencontainers/selinux/go-selinux"
"github.com/prometheus/client_golang/prometheus"
"log/slog"
)

type selinuxCollector struct {
Expand Down
3 changes: 2 additions & 1 deletion collector/softirqs_common.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,10 @@ package collector

import (
"fmt"
"log/slog"

"github.com/prometheus/client_golang/prometheus"
"github.com/prometheus/procfs"
"log/slog"
)

type softirqsCollector struct {
Expand Down
3 changes: 2 additions & 1 deletion collector/uname.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@
package collector

import (
"github.com/prometheus/client_golang/prometheus"
"log/slog"

"github.com/prometheus/client_golang/prometheus"
)

var unameDesc = prometheus.NewDesc(
Expand Down

0 comments on commit 16e2a50

Please sign in to comment.