Skip to content

Commit a4ed211

Browse files
authored
chore: golangci-lint configuration (#360)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent 92c3e5c commit a4ed211

File tree

9 files changed

+50
-10
lines changed

9 files changed

+50
-10
lines changed

.golangci.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
issues:
2+
exclude-dirs:
3+
- docs
4+
max-issues-per-linter: 0
5+
max-same-issues: 0
6+
linters:
7+
enable:
8+
- errcheck
9+
- gosec
10+
- gosimple
11+
- govet
12+
- ineffassign
13+
- staticcheck
14+
- unused
15+
run:
16+
issues-exit-code: 1
17+
tests: false
18+
timeout: 10m

docs/docs.go

Lines changed: 0 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

internal/api/api.go

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,10 +77,28 @@ func Start(cfg *config.Config) error {
7777
return
7878
}
7979
}
80-
accessLogger.Info("request received", "method", c.Request.Method, "path", c.Request.URL.Path, "remote_addr", c.ClientIP())
80+
accessLogger.Info(
81+
"request received",
82+
"method",
83+
c.Request.Method,
84+
"path",
85+
c.Request.URL.Path,
86+
"remote_addr",
87+
c.ClientIP(),
88+
)
8189
c.Next()
8290
statusCode := c.Writer.Status()
83-
accessLogger.Info("response sent", "status", statusCode, "method", c.Request.Method, "path", c.Request.URL.Path, "remote_addr", c.ClientIP())
91+
accessLogger.Info(
92+
"response sent",
93+
"status",
94+
statusCode,
95+
"method",
96+
c.Request.Method,
97+
"path",
98+
c.Request.URL.Path,
99+
"remote_addr",
100+
c.ClientIP(),
101+
)
84102
}
85103
router.Use(accessMiddleware)
86104

internal/node/chainsync.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Blink Labs Software
1+
// Copyright 2025 Blink Labs Software
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -29,6 +29,7 @@ import (
2929

3030
func buildChainSyncConfig(connCfg ConnectionConfig) chainsync.Config {
3131
cfg := config.GetConfig()
32+
// #nosec G115
3233
return chainsync.NewConfig(
3334
chainsync.WithBlockTimeout(
3435
time.Duration(cfg.Node.QueryTimeout)*time.Second,
@@ -102,6 +103,7 @@ func chainSyncRollForwardHandler(
102103
txEvt := event.New(
103104
"chainsync.transaction",
104105
time.Now(),
106+
// #nosec G115
105107
input_chainsync.NewTransactionContext(v, transaction, uint32(t), cfg.Node.NetworkMagic),
106108
input_chainsync.NewTransactionEvent(v, transaction, true, nil),
107109
)

internal/node/localstatequery.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Blink Labs Software
1+
// Copyright 2025 Blink Labs Software
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import (
2424

2525
func buildLocalStateQueryConfig() localstatequery.Config {
2626
cfg := config.GetConfig()
27+
// #nosec G115
2728
return localstatequery.NewConfig(
2829
localstatequery.WithAcquireTimeout(
2930
time.Duration(cfg.Node.Timeout)*time.Second,

internal/node/localtxmonitor.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Blink Labs Software
1+
// Copyright 2025 Blink Labs Software
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import (
2424

2525
func buildLocalTxMonitorConfig() localtxmonitor.Config {
2626
cfg := config.GetConfig()
27+
// #nosec G115
2728
return localtxmonitor.NewConfig(
2829
localtxmonitor.WithAcquireTimeout(
2930
time.Duration(cfg.Node.Timeout)*time.Second,

internal/node/localtxsubmission.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2024 Blink Labs Software
1+
// Copyright 2025 Blink Labs Software
22
//
33
// Licensed under the Apache License, Version 2.0 (the "License");
44
// you may not use this file except in compliance with the License.
@@ -24,6 +24,7 @@ import (
2424

2525
func buildLocalTxSubmissionConfig() localtxsubmission.Config {
2626
cfg := config.GetConfig()
27+
// #nosec G115
2728
return localtxsubmission.NewConfig(
2829
localtxsubmission.WithTimeout(
2930
time.Duration(cfg.Node.QueryTimeout) * time.Second,

internal/utxorpc/query.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ func (s *queryServiceServer) ReadUtxos(
139139
aud.TxoRef = txo
140140
txHash := hex.EncodeToString(txo.Hash)
141141
if utxoId.Hash.String() == txHash &&
142+
// #nosec G115
142143
uint32(utxoId.Idx) == txo.Index {
143144
aud.NativeBytes = utxo.Cbor()
144145
audc.Cardano = utxo.Utxorpc()
@@ -272,7 +273,7 @@ func (s *queryServiceServer) SearchUtxos(
272273
var audc query.AnyUtxoData_Cardano
273274
aud.TxoRef = &query.TxoRef{
274275
Hash: utxoId.Hash.Bytes(),
275-
Index: uint32(utxoId.Idx),
276+
Index: uint32(utxoId.Idx), // #nosec G115
276277
}
277278
aud.NativeBytes = utxo.Cbor()
278279
audc.Cardano = utxo.Utxorpc()

internal/utxorpc/submit.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ func (s *submitServiceServer) SubmitTx(
8080
}
8181
// Submit the transaction
8282
err = oConn.LocalTxSubmission().Client.SubmitTx(
83-
uint16(txType),
83+
uint16(txType), // #nosec G115
8484
txRawBytes,
8585
)
8686
if err != nil {

0 commit comments

Comments
 (0)