Skip to content

Commit

Permalink
update golangci-lint (celestiaorg#2868)
Browse files Browse the repository at this point in the history
- updates `golangci-lint` to 1.55 
- removes "double cache" when setting up golang, thus removing linter
noise (`Cannot open file...file exists`) so easier to see actual lint
errors

closes celestiaorg#2590
  • Loading branch information
ramin authored Oct 23, 2023
1 parent 1a5d63c commit e8eaf4a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ jobs:
- name: golangci-lint
uses: golangci/[email protected]
with:
version: v1.54.2
version: v1.55
skip-pkg-cache: true
skip-build-cache: true

go_mod_tidy_check:
name: Go Mod Tidy Check
Expand Down
4 changes: 2 additions & 2 deletions share/availability/test/corrupt_data.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (fb FraudulentBlockstore) Has(context.Context, cid.Cid) (bool, error) {
func (fb FraudulentBlockstore) Get(ctx context.Context, cid cid.Cid) (blocks.Block, error) {
key := cid.String()
if fb.Attacking {
key = "corrupt" + key
key = "corrupt_get" + key
}

data, err := fb.Datastore.Get(ctx, ds.NewKey(key))
Expand All @@ -76,7 +76,7 @@ func (fb FraudulentBlockstore) Get(ctx context.Context, cid cid.Cid) (blocks.Blo
func (fb FraudulentBlockstore) GetSize(ctx context.Context, cid cid.Cid) (int, error) {
key := cid.String()
if fb.Attacking {
key = "corrupt" + key
key = "corrupt_size" + key
}

return fb.Datastore.GetSize(ctx, ds.NewKey(key))
Expand Down
8 changes: 5 additions & 3 deletions share/eds/cache/metrics.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,19 +18,21 @@ type metrics struct {
}

func newMetrics(bc *AccessorCache) (*metrics, error) {
evictedCounter, err := meter.Int64Counter("eds_blockstore_cache_"+bc.name+"_evicted_counter",
metricsPrefix := "eds_blockstore_cache_" + bc.name

evictedCounter, err := meter.Int64Counter(metricsPrefix+"_evicted_counter",
metric.WithDescription("eds blockstore cache evicted event counter"))
if err != nil {
return nil, err
}

getCounter, err := meter.Int64Counter("eds_blockstore_cache_"+bc.name+"_get_counter",
getCounter, err := meter.Int64Counter(metricsPrefix+"_get_counter",
metric.WithDescription("eds blockstore cache evicted event counter"))
if err != nil {
return nil, err
}

cacheSize, err := meter.Int64ObservableGauge("eds_blockstore_cache_"+bc.name+"_size",
cacheSize, err := meter.Int64ObservableGauge(metricsPrefix+"_size",
metric.WithDescription("total amount of items in blockstore cache"),
)
if err != nil {
Expand Down

0 comments on commit e8eaf4a

Please sign in to comment.