Skip to content

Commit

Permalink
Add golangci-lint-action
Browse files Browse the repository at this point in the history
Signed-off-by: Alexey Semenyuk <[email protected]>
  • Loading branch information
alex-semenyuk committed Oct 9, 2023
1 parent ce0ec02 commit 5c7e193
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 33 deletions.
26 changes: 26 additions & 0 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: golangci-lint
on:
push:
branches:
- main
pull_request:

permissions:
contents: read

jobs:
golangci:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: v1.54.2
# --exclude=unused-parameter was added due to methods with TODO implementation
args: --exclude=unused-parameter --timeout=3m
6 changes: 2 additions & 4 deletions internal/tezos/blocklistener.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,8 @@ func (bl *blockListener) listenLoop() {
} else {
log.L(bl.ctx).Debugf("monitor: %s", err.Error())

select {
case <-bl.ctx.Done():
return
}
<-bl.ctx.Done()
return
}
continue
}
Expand Down
22 changes: 0 additions & 22 deletions internal/tezos/event_listener.go
Original file line number Diff line number Diff line change
@@ -1,29 +1,7 @@
package tezos

import (
"sync"

"github.com/hyperledger/firefly-common/pkg/fftypes"
)

// listenerConfig is the configuration parsed from generic FFCAPI connector framework JSON, into our Tezos specific options
type listenerConfig struct {
name string
fromBlock string
// options *listenerOptions
// filters []*eventFilter
signature string
}

// listener is the state we hold in memory for each individual listener that has been added
type listener struct {
id *fftypes.UUID
c *tezosConnector
es *eventStream
hwmMux sync.Mutex // Protects checkpoint of an individual listener. May hold ES lock when taking this, must NOT attempt to obtain ES lock while holding this
hwmBlock int64
config listenerConfig
removed bool
catchup bool
catchupLoopDone chan struct{}
}
9 changes: 2 additions & 7 deletions internal/tezos/event_stream.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package tezos

import (
"context"
"sync"

"github.com/hyperledger/firefly-common/pkg/fftypes"
"github.com/hyperledger/firefly-transaction-manager/pkg/ffcapi"
Expand All @@ -14,8 +13,6 @@ type eventStream struct {
ctx context.Context
c *tezosConnector
events chan<- *ffcapi.ListenerEvent
mux sync.Mutex
updateCount int
listeners map[fftypes.UUID]*listener
headBlock int64
streamLoopDone chan struct{}
Expand All @@ -31,10 +28,6 @@ func (es *eventStream) startEventListener(l *listener) {
// TODO: impl
}

func (es *eventStream) removeEventListener(listenerID *fftypes.UUID) {
// TODO: impl
}

func (es *eventStream) streamLoop() {
defer close(es.streamLoopDone)

Expand All @@ -57,6 +50,8 @@ func (es *eventStream) streamLoop() {
// leadGroupCatchup is called whenever the steam loop restarts, to see how far it is behind the head of the
// chain and if it's a way behind then we catch up all this head group as one set (rather than with individual
// catchup routines as is the case if one listener starts a way behind the pack)
//
//nolint:unparam
func (es *eventStream) leadGroupCatchup() bool {

// For API status, we keep a track of whether we're in catchup mode or not
Expand Down
1 change: 1 addition & 0 deletions internal/tezos/send_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ func (c *tezosConnector) TransactionSend(ctx context.Context, req *ffcapi.Transa
}, "", nil
}

// nolint:unparam
func (c *tezosConnector) signTxRemotely(ctx context.Context, op *codec.Op) error {
url := c.signatoryURL + "/keys/" + op.Source.String()
requestBody, _ := json.Marshal(hex.EncodeToString(op.WatermarkedBytes()))
Expand Down

0 comments on commit 5c7e193

Please sign in to comment.