Skip to content

Commit

Permalink
chore(lint): fix staticcheck linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
iand committed Dec 3, 2020
1 parent 4021e6c commit e55fdfb
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 16 deletions.
1 change: 0 additions & 1 deletion chain/indexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ var _ indexer.TipSetObserver = (*TipSetIndexer)(nil)
// A TipSetWatcher waits for tipsets and persists their block data into a database.
type TipSetIndexer struct {
window time.Duration
opener lens.APIOpener
storage Storage
processors map[string]TipSetProcessor
name string
Expand Down
1 change: 0 additions & 1 deletion commands/setup.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import (
"fmt"
"net/http"
"net/http/pprof"
_ "net/http/pprof"
"strings"
"time"

Expand Down
2 changes: 1 addition & 1 deletion lens/lotusrepo/repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
"github.com/filecoin-project/specs-actors/actors/util/adt"
"github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor"
peer "github.com/libp2p/go-libp2p-peer"
peer "github.com/libp2p/go-libp2p-core/peer"
"github.com/urfave/cli/v2"

"github.com/filecoin-project/sentinel-visor/lens"
Expand Down
11 changes: 5 additions & 6 deletions lens/s3repo/store.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ type S3Blockstore struct {
}

func NewBlockStore(connstr string) (blockstore.Blockstore, error) {

sbs := &S3Blockstore{
prefix: connstr,
client: http.Client{},
Expand All @@ -42,7 +41,7 @@ func (sbs *S3Blockstore) Has(c cid.Cid) (has bool, err error) {
}

func (sbs *S3Blockstore) AllKeysChan(ctx context.Context) (<-chan cid.Cid, error) {
return nil, fmt.Errorf("Not implemented")
return nil, fmt.Errorf("not implemented")
}

func (sbs *S3Blockstore) Get(c cid.Cid) (blocks.Block, error) {
Expand All @@ -51,7 +50,7 @@ func (sbs *S3Blockstore) Get(c cid.Cid) (blocks.Block, error) {
return nil, err
}
if resp.StatusCode != http.StatusOK {
return nil, fmt.Errorf("Failed to fetch: %v", resp.StatusCode)
return nil, fmt.Errorf("failed to fetch: %v", resp.StatusCode)
}
defer resp.Body.Close()
buf, err := ioutil.ReadAll(resp.Body)
Expand Down Expand Up @@ -107,13 +106,13 @@ func (sbs *S3Blockstore) HashOnRead(enabled bool) {

// Put puts a given block to the underlying datastore
func (sbs *S3Blockstore) Put(b blocks.Block) (err error) {
return fmt.Errorf("Not Implemented")
return fmt.Errorf("not implemented")
}

func (sbs *S3Blockstore) PutMany(blks []blocks.Block) error {
return fmt.Errorf("Not Implemented")
return fmt.Errorf("not implemented")
}

func (sbs *S3Blockstore) DeleteBlock(cid.Cid) error {
return fmt.Errorf("Not Implemented")
return fmt.Errorf("not implemented")
}
4 changes: 2 additions & 2 deletions tasks/actorstate/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ type MinerStateExtractionContext struct {
}

func (m *MinerStateExtractionContext) IsGenesis() bool {
return 0 == m.CurrTs.Height()
return m.CurrTs.Height() == 0
}

func ExtractMinerInfo(a ActorInfo, ec *MinerStateExtractionContext) (*minermodel.MinerInfo, error) {
Expand Down Expand Up @@ -620,7 +620,7 @@ type PartitionStatus struct {
}

func extractMinerPartitionsDiff(ctx context.Context, ec *MinerStateExtractionContext) (*PartitionStatus, error) {
ctx, span := global.Tracer("").Start(ctx, "StorageMinerExtractor.minerPartitionDiff") // nolint: ineffassign,staticcheck
_, span := global.Tracer("").Start(ctx, "StorageMinerExtractor.minerPartitionDiff") // nolint: ineffassign,staticcheck
defer span.End()

// short circuit genesis state.
Expand Down
2 changes: 1 addition & 1 deletion tasks/actorstate/power.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ type PowerStateExtractionContext struct {
}

func (p *PowerStateExtractionContext) IsGenesis() bool {
return 0 == p.CurrTs.Height()
return p.CurrTs.Height() == 0
}

func (StoragePowerExtractor) Extract(ctx context.Context, a ActorInfo, node ActorStateAPI) (model.PersistableWithTx, error) {
Expand Down
8 changes: 6 additions & 2 deletions tasks/indexer/chainheadindexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,9 @@ func (c *ChainHeadIndexer) index(ctx context.Context, headEvents []*lotus_api.He

// If we have a zero confidence window then we need to notify every tipset we see
if c.confidence == 0 {
c.obs.TipSet(ctx, ch.Val)
if err := c.obs.TipSet(ctx, ch.Val); err != nil {
return xerrors.Errorf("notify tipset: %w", err)
}
}
case store.HCApply:
log.Debugw("add tipset", "height", ch.Val.Height(), "tipset", ch.Val.Key().String())
Expand All @@ -102,7 +104,9 @@ func (c *ChainHeadIndexer) index(ctx context.Context, headEvents []*lotus_api.He

// Send the tipset that fell out of the confidence window to the observer
if tail != nil {
c.obs.TipSet(ctx, tail)
if err := c.obs.TipSet(ctx, tail); err != nil {
return xerrors.Errorf("notify tipset: %w", err)
}
}

case store.HCRevert:
Expand Down
8 changes: 6 additions & 2 deletions tasks/indexer/chainhistoryindexer.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,9 @@ func (c *ChainHistoryIndexer) WalkChain(ctx context.Context, node lens.API, ts *
ctx, _ = tag.New(ctx, tag.Upsert(metrics.TaskType, "indexhistoryblock"))

log.Debugw("found tipset", "height", ts.Height())
c.obs.TipSet(ctx, ts)
if err := c.obs.TipSet(ctx, ts); err != nil {
return xerrors.Errorf("notify tipset: %w", err)
}

var err error
for int64(ts.Height()) >= c.minHeight && ts.Height() > 0 {
Expand All @@ -89,7 +91,9 @@ func (c *ChainHistoryIndexer) WalkChain(ctx context.Context, node lens.API, ts *
}

log.Debugw("found tipset", "height", ts.Height())
c.obs.TipSet(ctx, ts)
if err := c.obs.TipSet(ctx, ts); err != nil {
return xerrors.Errorf("notify tipset: %w", err)
}

}

Expand Down

0 comments on commit e55fdfb

Please sign in to comment.