Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/go_modules/otel-a4628cb440
Browse files Browse the repository at this point in the history
  • Loading branch information
ramin authored Feb 26, 2024
2 parents 19e4948 + 1a20776 commit 6a94189
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
go-version: ${{ inputs.go-version }}

- name: golangci-lint
uses: golangci/golangci-lint-action@v3.7.0
uses: golangci/golangci-lint-action@v4.0.0
with:
args: --timeout 10m
version: v1.55
Expand Down
3 changes: 2 additions & 1 deletion api/docgen/examples.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package docgen
import (
_ "embed"
"encoding/json"
"errors"
"fmt"
"reflect"

Expand Down Expand Up @@ -66,7 +67,7 @@ var ExampleValues = map[reflect.Type]interface{}{
Shares: []*byzantine.ShareWithProof{},
},
),
reflect.TypeOf((*error)(nil)).Elem(): fmt.Errorf("error"),
reflect.TypeOf((*error)(nil)).Elem(): errors.New("error"),
}

func init() {
Expand Down
2 changes: 1 addition & 1 deletion cmd/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func AuthCmd(fsets ...*flag.FlagSet) *cobra.Command {
"the node has already been initialized and started.",
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 1 {
return fmt.Errorf("must specify permissions")
return errors.New("must specify permissions")
}
permissions, err := convertToPerms(args[0])
if err != nil {
Expand Down
5 changes: 3 additions & 2 deletions cmd/cel-shed/header.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package main

import (
"errors"
"fmt"
"strconv"
"strings"
Expand Down Expand Up @@ -30,12 +31,12 @@ Custom store path is not supported yet.`,
SilenceUsage: true,
RunE: func(cmd *cobra.Command, args []string) error {
if len(args) != 3 {
return fmt.Errorf("not enough arguments")
return errors.New("not enough arguments")
}

tp := node.ParseType(args[0])
if !tp.IsValid() {
return fmt.Errorf("invalid node-type")
return errors.New("invalid node-type")
}

network := args[1]
Expand Down
2 changes: 1 addition & 1 deletion cmd/rpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ func InitClient(cmd *cobra.Command, _ []string) error {
if authTokenFlag == "" {
storePath := ""
if !cmd.Flag(nodeStoreFlag).Changed {
return fmt.Errorf("cant get the access to the auth token: token/node-store flag was not specified")
return errors.New("cant get the access to the auth token: token/node-store flag was not specified")
}
storePath = cmd.Flag(nodeStoreFlag).Value.String()
token, err := getToken(storePath)
Expand Down
3 changes: 2 additions & 1 deletion core/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package core

import (
"context"
"errors"
"fmt"

logging "github.com/ipfs/go-log/v2"
Expand Down Expand Up @@ -127,7 +128,7 @@ func (f *BlockFetcher) ValidatorSet(ctx context.Context, height *int64) (*types.
func (f *BlockFetcher) SubscribeNewBlockEvent(ctx context.Context) (<-chan types.EventDataSignedBlock, error) {
// start the client if not started yet
if !f.client.IsRunning() {
return nil, fmt.Errorf("client not running")
return nil, errors.New("client not running")
}

ctx, cancel := context.WithCancel(ctx)
Expand Down
2 changes: 1 addition & 1 deletion core/listener.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ func NewListener(
// Start kicks off the Listener listener loop.
func (cl *Listener) Start(context.Context) error {
if cl.cancel != nil {
return fmt.Errorf("listener: already started")
return errors.New("listener: already started")
}

ctx, cancel := context.WithCancel(context.Background())
Expand Down
2 changes: 1 addition & 1 deletion das/daser.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func NewDASer(
// Start initiates subscription for new ExtendedHeaders and spawns a sampling routine.
func (d *DASer) Start(ctx context.Context) error {
if !atomic.CompareAndSwapInt32(&d.running, 0, 1) {
return fmt.Errorf("da: DASer already started")
return errors.New("da: DASer already started")
}

sub, err := d.hsub.Subscribe()
Expand Down
3 changes: 2 additions & 1 deletion das/options.go
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
package das

import (
"errors"
"fmt"
"time"
)

// ErrInvalidOption is an error that is returned by Parameters.Validate
// when supplied with invalid values.
// This error will also be returned by NewDASer if supplied with an invalid option
var ErrInvalidOption = fmt.Errorf("das: invalid option")
var ErrInvalidOption = errors.New("das: invalid option")

// errInvalidOptionValue is a utility function to dedup code for error-returning
// when dealing with invalid parameter values
Expand Down
2 changes: 1 addition & 1 deletion share/eds/inverted_index.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import (
const invertedIndexPath = "/inverted_index/"

// ErrNotFoundInIndex is returned instead of ErrNotFound if the multihash doesn't exist in the index
var ErrNotFoundInIndex = fmt.Errorf("does not exist in index")
var ErrNotFoundInIndex = errors.New("does not exist in index")

// simpleInvertedIndex is an inverted index that only stores a single shard key per multihash. Its
// implementation is modified from the default upstream implementation in dagstore/index.
Expand Down
8 changes: 4 additions & 4 deletions share/eds/store_options.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package eds

import (
"fmt"
"errors"
"time"
)

Expand Down Expand Up @@ -29,15 +29,15 @@ func DefaultParameters() *Parameters {

func (p *Parameters) Validate() error {
if p.GCInterval < 0 {
return fmt.Errorf("eds: GC interval cannot be negative")
return errors.New("eds: GC interval cannot be negative")
}

if p.RecentBlocksCacheSize < 1 {
return fmt.Errorf("eds: recent blocks cache size must be positive")
return errors.New("eds: recent blocks cache size must be positive")
}

if p.BlockstoreCacheSize < 1 {
return fmt.Errorf("eds: blockstore cache size must be positive")
return errors.New("eds: blockstore cache size must be positive")
}
return nil
}

0 comments on commit 6a94189

Please sign in to comment.