Skip to content

Commit 64ecd92

Browse files
authored
chore: configuration for golangci-lint (#903)
Signed-off-by: Chris Gianelloni <[email protected]>
1 parent e08b8f5 commit 64ecd92

File tree

8 files changed

+35
-13
lines changed

8 files changed

+35
-13
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

cmd/gouroboros/chainsync.go

Lines changed: 3 additions & 3 deletions
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.
@@ -172,7 +172,7 @@ func testChainSync(f *globalFlags) {
172172
}()
173173
o, err := ouroboros.New(
174174
ouroboros.WithConnection(conn),
175-
ouroboros.WithNetworkMagic(uint32(f.networkMagic)),
175+
ouroboros.WithNetworkMagic(uint32(f.networkMagic)), // #nosec G115
176176
ouroboros.WithErrorChan(errorChan),
177177
ouroboros.WithNodeToNode(f.ntnProto),
178178
ouroboros.WithKeepAlive(true),
@@ -199,7 +199,7 @@ func testChainSync(f *globalFlags) {
199199
point = tip.Point
200200
} else if len(intersectPoint) > 0 {
201201
// Slot
202-
slot := uint64(intersectPoint[0].(int))
202+
slot := uint64(intersectPoint[0].(int)) // #nosec G115
203203
// Block hash
204204
hash, _ := hex.DecodeString(intersectPoint[1].(string))
205205
point = common.NewPoint(slot, hash)

cmd/gouroboros/localtxsubmission.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2023 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.
@@ -79,7 +79,7 @@ func testLocalTxSubmission(f *globalFlags) {
7979
}()
8080
o, err := ouroboros.New(
8181
ouroboros.WithConnection(conn),
82-
ouroboros.WithNetworkMagic(uint32(f.networkMagic)),
82+
ouroboros.WithNetworkMagic(uint32(f.networkMagic)), // #nosec G115
8383
ouroboros.WithErrorChan(errorChan),
8484
ouroboros.WithNodeToNode(f.ntnProto),
8585
ouroboros.WithKeepAlive(true),

cmd/gouroboros/mem_usage.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ import (
1919
"fmt"
2020
"log"
2121
"net/http"
22-
_ "net/http/pprof"
2322
"os"
2423
"runtime"
2524
"runtime/pprof"
2625
"time"
2726

27+
// #nosec G108
28+
_ "net/http/pprof"
29+
2830
ouroboros "github.com/blinklabs-io/gouroboros"
2931
)
3032

@@ -70,6 +72,8 @@ func testMemUsage(f *globalFlags) {
7072
)
7173
go func() {
7274
log.Println(
75+
// This is a test program, no timeouts
76+
// #nosec G114
7377
http.ListenAndServe(
7478
fmt.Sprintf(":%d", memUsageFlags.debugPort),
7579
nil,
@@ -94,7 +98,7 @@ func testMemUsage(f *globalFlags) {
9498
}()
9599
o, err := ouroboros.New(
96100
ouroboros.WithConnection(conn),
97-
ouroboros.WithNetworkMagic(uint32(f.networkMagic)),
101+
ouroboros.WithNetworkMagic(uint32(f.networkMagic)), // #nosec G115
98102
ouroboros.WithErrorChan(errorChan),
99103
ouroboros.WithNodeToNode(f.ntnProto),
100104
ouroboros.WithKeepAlive(true),

cmd/gouroboros/query.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ func testQuery(f *globalFlags) {
6666
}()
6767
o, err := ouroboros.New(
6868
ouroboros.WithConnection(conn),
69-
ouroboros.WithNetworkMagic(uint32(f.networkMagic)),
69+
ouroboros.WithNetworkMagic(uint32(f.networkMagic)), // #nosec G115
7070
ouroboros.WithErrorChan(errorChan),
7171
ouroboros.WithNodeToNode(f.ntnProto),
7272
ouroboros.WithKeepAlive(true),

cmd/gouroboros/server.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func testServer(f *globalFlags) {
9090
}()
9191
_, err = ouroboros.New(
9292
ouroboros.WithConnection(conn),
93-
ouroboros.WithNetworkMagic(uint32(f.networkMagic)),
93+
ouroboros.WithNetworkMagic(uint32(f.networkMagic)), // #nosec G115
9494
ouroboros.WithErrorChan(errorChan),
9595
ouroboros.WithNodeToNode(f.ntnProto),
9696
ouroboros.WithServer(true),

cmd/tx-submission/main.go

Lines changed: 3 additions & 3 deletions
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.
@@ -68,7 +68,7 @@ func main() {
6868
}()
6969
o, err := ouroboros.New(
7070
ouroboros.WithConnection(conn),
71-
ouroboros.WithNetworkMagic(uint32(f.NetworkMagic)),
71+
ouroboros.WithNetworkMagic(uint32(f.NetworkMagic)), // #nosec G115
7272
ouroboros.WithErrorChan(errorChan),
7373
ouroboros.WithNodeToNode(f.NtnProto),
7474
ouroboros.WithKeepAlive(true),
@@ -164,7 +164,7 @@ func handleRequestTxIds(
164164
EraId: 5,
165165
TxId: txHash,
166166
},
167-
Size: uint32(len(txBytes)),
167+
Size: uint32(len(txBytes)), // #nosec G115
168168
},
169169
}
170170
return ret, nil

ledger/conway/conway.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ func (r ConwayRedeemers) Indexes(tag common.RedeemerTag) []uint {
203203
func (r ConwayRedeemers) Value(index uint, tag common.RedeemerTag) (cbor.LazyValue, common.RedeemerExUnits) {
204204
redeemer, ok := r.Redeemers[ConwayRedeemerKey{
205205
Tag: tag,
206-
Index: uint32(index),
206+
Index: uint32(index), // #nosec G115
207207
}]
208208
if ok {
209209
return redeemer.Data, redeemer.ExUnits

0 commit comments

Comments
 (0)