fix: deepsource suggestions

This commit is contained in:
Mohamed Sohail 2023-01-11 08:42:00 +00:00
parent e2f7d1860d
commit f1e74961b0
Signed by: kamikazechaser
GPG Key ID: 7DD45520C01CD85D
9 changed files with 7 additions and 19 deletions

View File

@ -16,8 +16,3 @@ func initTransferFilter() filter.Filter {
}) })
} }
func initNoopFilter() filter.Filter {
return filter.NewNoopFilter(filter.NoopFilterOpts{
Logg: lo,
})
}

View File

@ -89,7 +89,7 @@ func main() {
SweepInterval: time.Second * time.Duration(ko.MustInt64("syncer.sweep_interval")), SweepInterval: time.Second * time.Duration(ko.MustInt64("syncer.sweep_interval")),
}) })
apiServer.GET("/stats", api.StatsHandler(syncerStats, workerPool, lo)) apiServer.GET("/stats", api.StatsHandler(syncerStats, workerPool))
wg.Add(1) wg.Add(1)
go func() { go func() {

2
go.mod
View File

@ -6,6 +6,7 @@ require (
github.com/VictoriaMetrics/metrics v1.23.0 github.com/VictoriaMetrics/metrics v1.23.0
github.com/alitto/pond v1.8.2 github.com/alitto/pond v1.8.2
github.com/celo-org/celo-blockchain v1.6.1 github.com/celo-org/celo-blockchain v1.6.1
github.com/goccy/go-json v0.10.0
github.com/jackc/pgx/v5 v5.2.0 github.com/jackc/pgx/v5 v5.2.0
github.com/knadh/goyesql/v2 v2.2.0 github.com/knadh/goyesql/v2 v2.2.0
github.com/knadh/koanf v1.4.5 github.com/knadh/koanf v1.4.5
@ -23,7 +24,6 @@ require (
github.com/fsnotify/fsnotify v1.4.9 // indirect github.com/fsnotify/fsnotify v1.4.9 // indirect
github.com/go-ole/go-ole v1.2.5 // indirect github.com/go-ole/go-ole v1.2.5 // indirect
github.com/go-stack/stack v1.8.0 // indirect github.com/go-stack/stack v1.8.0 // indirect
github.com/goccy/go-json v0.10.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect github.com/gorilla/websocket v1.4.2 // indirect
github.com/jackc/pgpassfile v1.0.0 // indirect github.com/jackc/pgpassfile v1.0.0 // indirect
github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect github.com/jackc/pgservicefile v0.0.0-20200714003250-2b9c44734f2b // indirect

View File

@ -6,7 +6,6 @@ import (
"github.com/alitto/pond" "github.com/alitto/pond"
"github.com/grassrootseconomics/cic-chain-events/internal/syncer" "github.com/grassrootseconomics/cic-chain-events/internal/syncer"
"github.com/labstack/echo/v4" "github.com/labstack/echo/v4"
"github.com/zerodha/logf"
) )
type statsResponse struct { type statsResponse struct {
@ -22,7 +21,6 @@ type statsResponse struct {
func StatsHandler( func StatsHandler(
syncerStats *syncer.Stats, syncerStats *syncer.Stats,
poolStats *pond.WorkerPool, poolStats *pond.WorkerPool,
logg logf.Logger,
) func(echo.Context) error { ) func(echo.Context) error {
return func(ctx echo.Context) error { return func(ctx echo.Context) error {
headCursor := syncerStats.GetHeadCursor() headCursor := syncerStats.GetHeadCursor()

View File

@ -8,8 +8,3 @@ type okResp struct {
Ok bool `json:"ok"` Ok bool `json:"ok"`
Data interface{} `json:"data"` Data interface{} `json:"data"`
} }
type errResp struct {
Ok bool `json:"ok"`
Error string `json:"error"`
}

View File

@ -25,7 +25,7 @@ func NewAddressFilter(o AddressFilterOpts) Filter {
} }
} }
func (f *AddressFilter) Execute(ctx context.Context, transaction fetch.Transaction) (bool, error) { func (*AddressFilter) Execute(_ context.Context, transaction fetch.Transaction) (bool, error) {
if transaction.To.Address == cUSD { if transaction.To.Address == cUSD {
return true, nil return true, nil
} }

View File

@ -21,7 +21,7 @@ func NewNoopFilter(o NoopFilterOpts) Filter {
} }
} }
func (f *NoopFilter) Execute(ctx context.Context, transaction fetch.Transaction) (bool, error) { func (f *NoopFilter) Execute(_ context.Context, transaction fetch.Transaction) (bool, error) {
f.logg.Debug("noop filter", "block", transaction.Block.Number, "index", transaction.Index) f.logg.Debug("noop filter", "block", transaction.Block.Number, "index", transaction.Index)
return true, nil return true, nil
} }

View File

@ -21,7 +21,7 @@ func NewTransferFilter(o TransferFilterOpts) Filter {
} }
} }
func (f *TransferFilter) Execute(ctx context.Context, transaction fetch.Transaction) (bool, error) { func (f *TransferFilter) Execute(_ context.Context, transaction fetch.Transaction) (bool, error) {
switch transaction.InputData[:10] { switch transaction.InputData[:10] {
case "0xa9059cbb": case "0xa9059cbb":
f.logg.Info("cUSD transfer", "block", transaction.Block.Number, "index", transaction.Index) f.logg.Info("cUSD transfer", "block", transaction.Block.Number, "index", transaction.Index)

View File

@ -33,7 +33,7 @@ func newErrorFilter() filter.Filter {
return &errorFilter{} return &errorFilter{}
} }
func (f *errorFilter) Execute(ctx context.Context, transaction fetch.Transaction) (bool, error) { func (*errorFilter) Execute(_ context.Context, _ fetch.Transaction) (bool, error) {
return false, errors.New("crash") return false, errors.New("crash")
} }
@ -43,7 +43,7 @@ func newEarlyExitFilter() filter.Filter {
return &earlyExitFilter{} return &earlyExitFilter{}
} }
func (f *earlyExitFilter) Execute(ctx context.Context, transaction fetch.Transaction) (bool, error) { func (*earlyExitFilter) Execute(_ context.Context, _ fetch.Transaction) (bool, error) {
return false, nil return false, nil
} }