Skip to content

Commit c3770dd

Browse files
committed
chore(golangci-lint): enable format, import, and unused presets; disable depguard
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 1c1680d commit c3770dd

File tree

6 files changed

+26
-23
lines changed

6 files changed

+26
-23
lines changed

.golangci.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ issues:
44
max-issues-per-linter: 0
55
max-same-issues: 0
66
linters:
7+
disable:
8+
- depguard
79
enable:
810
- errcheck
911
- gosimple
@@ -12,9 +14,15 @@ linters:
1214
- staticcheck
1315
- unused
1416
# Defaults above ours below
17+
- copyloopvar
18+
- usestdlibvars
19+
- whitespace
1520
presets:
1621
- bugs
22+
- format
23+
- import
1724
- performance
25+
- unused
1826
#linters-settings:
1927
# errcheck:
2028
# check-type-assertions: true

cmd/cdnsd/main.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,19 @@ import (
1111
"fmt"
1212
"log/slog"
1313
"net/http"
14-
"os"
15-
"time"
16-
1714
// #nosec G108
1815
_ "net/http/pprof"
19-
20-
"github.com/prometheus/client_golang/prometheus/promhttp"
21-
"go.uber.org/automaxprocs/maxprocs"
16+
"os"
17+
"time"
2218

2319
"github.com/blinklabs-io/cdnsd/internal/config"
2420
"github.com/blinklabs-io/cdnsd/internal/dns"
2521
"github.com/blinklabs-io/cdnsd/internal/indexer"
2622
"github.com/blinklabs-io/cdnsd/internal/logging"
2723
"github.com/blinklabs-io/cdnsd/internal/state"
2824
"github.com/blinklabs-io/cdnsd/internal/version"
25+
"github.com/prometheus/client_golang/prometheus/promhttp"
26+
"go.uber.org/automaxprocs/maxprocs"
2927
)
3028

3129
var cmdlineFlags struct {

internal/dns/dns.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,18 +19,15 @@ import (
1919

2020
"github.com/blinklabs-io/cdnsd/internal/config"
2121
"github.com/blinklabs-io/cdnsd/internal/state"
22-
2322
"github.com/miekg/dns"
2423
"github.com/prometheus/client_golang/prometheus"
2524
"github.com/prometheus/client_golang/prometheus/promauto"
2625
)
2726

28-
var (
29-
metricQueryTotal = promauto.NewCounter(prometheus.CounterOpts{
30-
Name: "dns_query_total",
31-
Help: "total DNS queries handled",
32-
})
33-
)
27+
var metricQueryTotal = promauto.NewCounter(prometheus.CounterOpts{
28+
Name: "dns_query_total",
29+
Help: "total DNS queries handled",
30+
})
3431

3532
func Start() error {
3633
cfg := config.GetConfig()

internal/indexer/indexer.go

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,22 @@ import (
1616
"strings"
1717
"time"
1818

19-
"github.com/blinklabs-io/cdnsd/internal/config"
20-
"github.com/blinklabs-io/cdnsd/internal/logging"
21-
"github.com/blinklabs-io/cdnsd/internal/state"
22-
ouroboros "github.com/blinklabs-io/gouroboros"
23-
"github.com/prometheus/client_golang/prometheus"
24-
"github.com/prometheus/client_golang/prometheus/promauto"
25-
2619
"github.com/blinklabs-io/adder/event"
2720
filter_event "github.com/blinklabs-io/adder/filter/event"
2821
input_chainsync "github.com/blinklabs-io/adder/input/chainsync"
2922
output_embedded "github.com/blinklabs-io/adder/output/embedded"
3023
"github.com/blinklabs-io/adder/pipeline"
3124
models "github.com/blinklabs-io/cardano-models"
25+
"github.com/blinklabs-io/cdnsd/internal/config"
26+
"github.com/blinklabs-io/cdnsd/internal/logging"
27+
"github.com/blinklabs-io/cdnsd/internal/state"
28+
ouroboros "github.com/blinklabs-io/gouroboros"
3229
"github.com/blinklabs-io/gouroboros/cbor"
3330
"github.com/blinklabs-io/gouroboros/ledger"
3431
ocommon "github.com/blinklabs-io/gouroboros/protocol/common"
3532
"github.com/miekg/dns"
33+
"github.com/prometheus/client_golang/prometheus"
34+
"github.com/prometheus/client_golang/prometheus/promauto"
3635
)
3736

3837
const (

internal/logging/logging.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ func Configure() {
4848
Level: level,
4949
})
5050
globalLogger = slog.New(handler).With("component", "main")
51-
5251
}
5352

5453
func GetLogger() *slog.Logger {

internal/version/version.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ import (
1111
)
1212

1313
// These are populated at build time
14-
var Version string
15-
var CommitHash string
14+
var (
15+
Version string
16+
CommitHash string
17+
)
1618

1719
func GetVersionString() string {
1820
if Version != "" {

0 commit comments

Comments
 (0)