Skip to content

Commit eaed010

Browse files
authored
Merge pull request #6 from cloudstruct/feature/golangci-lint
Configure golangci-lint CI workflow
2 parents dc9cb0a + 736a790 commit eaed010

File tree

5 files changed

+50
-15
lines changed

5 files changed

+50
-15
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
# This file was copied from the following URL and modified:
2+
# https://github.com/golangci/golangci-lint-action/blob/master/README.md#how-to-use
3+
4+
name: golangci-lint
5+
on:
6+
push:
7+
tags:
8+
- v*
9+
branches:
10+
- master
11+
- main
12+
pull_request:
13+
permissions:
14+
contents: read
15+
# Optional: allow read access to pull request. Use with `only-new-issues` option.
16+
# pull-requests: read
17+
jobs:
18+
golangci:
19+
name: lint
20+
runs-on: ubuntu-latest
21+
steps:
22+
- uses: actions/checkout@v2
23+
- name: golangci-lint
24+
uses: golangci/golangci-lint-action@v2
25+
with:
26+
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
27+
version: v1.43 # current version at time of commit
28+
29+
# Optional: working directory, useful for monorepos
30+
# working-directory: somedir
31+
32+
# Optional: golangci-lint command line arguments.
33+
# args: --issues-exit-code=0
34+
35+
# Optional: show only new issues if it's a pull request. The default value is `false`.
36+
# only-new-issues: true
37+
38+
# Optional: if set to true then the action will use pre-installed Go.
39+
# skip-go-installation: true
40+
41+
# Optional: if set to true then the action don't cache or restore ~/go/pkg.
42+
# skip-pkg-cache: true
43+
44+
# Optional: if set to true then the action don't cache or restore ~/.cache/go-build.
45+
# skip-build-cache: true

cmd/go-ouroboros-network/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ func main() {
136136
fmt.Printf("ERROR: unknown era '%s' specified as chain-sync start point\n", f.syncEra)
137137
os.Exit(1)
138138
}
139-
syncState.readyForNextBlockChan = make(chan bool, 0)
139+
syncState.readyForNextBlockChan = make(chan bool)
140140
intersect := []interface{}{}
141141
if len(eraIntersect[f.networkMagic][f.syncEra]) > 0 {
142142
// Slot

muxer/muxer.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,9 @@ func (m *Muxer) RegisterProtocol(protocolId uint16) (chan *Message, chan *Messag
3636
go func() {
3737
for {
3838
msg := <-senderChan
39-
m.Send(msg)
39+
if err := m.Send(msg); err != nil {
40+
m.ErrorChan <- err
41+
}
4042
}
4143
}()
4244
return senderChan, receiverChan

protocol/chainsync/messages.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,6 @@ func newMsgFindIntersect(points []interface{}) *msgFindIntersect {
3636
return m
3737
}
3838

39-
type msgAwaitReply struct {
40-
// Tells the CBOR decoder to convert to/from a struct and a CBOR array
41-
_ struct{} `cbor:",toarray"`
42-
MessageType uint8
43-
}
44-
4539
type msgRollForward struct {
4640
// Tells the CBOR decoder to convert to/from a struct and a CBOR array
4741
_ struct{} `cbor:",toarray"`
@@ -80,12 +74,6 @@ type msgIntersectNotFound struct {
8074
Tip tip
8175
}
8276

83-
type msgDone struct {
84-
// Tells the CBOR decoder to convert to/from a struct and a CBOR array
85-
_ struct{} `cbor:",toarray"`
86-
MessageType uint8
87-
}
88-
8977
type tip struct {
9078
// Tells the CBOR decoder to convert to/from a struct and a CBOR array
9179
_ struct{} `cbor:",toarray"`

utils/debug.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ func DumpCborStructure(data interface{}, prefix string) string {
5555
// Add 2 more spaces to the new prefix
5656
newPrefix = fmt.Sprintf(" %s", newPrefix)
5757
for key, val := range v {
58-
ret.WriteString(fmt.Sprintf("%s%#v => %#v,\n", prefix, key, val))
58+
ret.WriteString(fmt.Sprintf("%s%#v => %#v,\n", newPrefix, key, val))
5959
}
6060
ret.WriteString(fmt.Sprintf("%s}\n", prefix))
6161
default:

0 commit comments

Comments
 (0)