Skip to content

Commit 81a47c0

Browse files
committed
update frisbii, lint tool, go version
1 parent 87d046e commit 81a47c0

File tree

114 files changed

+1113
-572
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

114 files changed

+1113
-572
lines changed

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ jobs:
271271
default: golang
272272
golangci-lint-version:
273273
type: string
274-
default: 1.60.1
274+
default: 2.4.0
275275
concurrency:
276276
type: string
277277
default: '2'

.github/workflows/ci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ jobs:
144144

145145
- name: Install golangci-lint
146146
run: |
147-
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v1.60.1
147+
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(go env GOPATH)/bin v2.4.0
148148
shell: bash
149149

150150
- name: Lint

cli/node/node.go

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,12 @@ package node
33
import (
44
"bytes"
55
"context"
6+
"crypto/rand"
67
"errors"
78
"fmt"
89
"os"
910
"path/filepath"
1011

11-
crand "crypto/rand"
12-
1312
"github.com/filecoin-project/boost/lib/keystore"
1413
"github.com/filecoin-project/go-address"
1514
"github.com/filecoin-project/lotus/chain/types"
@@ -33,7 +32,7 @@ func Setup(cfgdir string) (*Node, error) {
3332

3433
_, err = os.Stat(cfgdir)
3534
if err != nil && errors.Is(err, os.ErrNotExist) {
36-
return nil, errors.New("repo dir doesn't exist. run `boost init` first.")
35+
return nil, errors.New("repo dir doesn't exist. run `boost init` first")
3736
}
3837

3938
peerkey, err := loadOrInitPeerKey(keyPath(cfgdir))
@@ -67,7 +66,7 @@ func loadOrInitPeerKey(kf string) (crypto.PrivKey, error) {
6766
return nil, err
6867
}
6968

70-
k, _, err := crypto.GenerateEd25519Key(crand.Reader)
69+
k, _, err := crypto.GenerateEd25519Key(rand.Reader)
7170
if err != nil {
7271
return nil, err
7372
}

cmd/boost/deal_cmd.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,9 @@ func dealCmdAction(cctx *cli.Context, isOnline bool) error {
282282
if err != nil {
283283
return fmt.Errorf("failed to open stream to peer %s: %w", addrInfo.ID, err)
284284
}
285-
defer s.Close()
285+
defer func() {
286+
_ = s.Close()
287+
}()
286288

287289
var resp types.DealResponse
288290
if err := doRpc(ctx, s, &dealParams, &resp); err != nil {

cmd/boost/deal_status_cmd.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import (
66

77
bcli "github.com/filecoin-project/boost/cli"
88
"github.com/filecoin-project/boost/cli/node"
9-
clinode "github.com/filecoin-project/boost/cli/node"
109
"github.com/filecoin-project/boost/cmd"
1110
"github.com/filecoin-project/boost/storagemarket/lp2pimpl"
1211
"github.com/filecoin-project/boost/storagemarket/types"
@@ -45,7 +44,7 @@ var dealStatusCmd = &cli.Command{
4544
return err
4645
}
4746

48-
n, err := clinode.Setup(cctx.String(cmd.FlagRepo.Name))
47+
n, err := node.Setup(cctx.String(cmd.FlagRepo.Name))
4948
if err != nil {
5049
return err
5150
}

cmd/boost/direct_deal.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,9 @@ var directDealAllocate = &cli.Command{
130130
if err != nil {
131131
return err
132132
}
133-
defer file.Close()
133+
defer func() {
134+
_ = file.Close()
135+
}()
134136
scanner := bufio.NewScanner(file)
135137
for scanner.Scan() {
136138
line := scanner.Text()

cmd/boost/helper.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,15 @@ func NewAppFmt(a *ufcli.App) *AppFmt {
2525
}
2626

2727
func (a *AppFmt) Print(args ...interface{}) {
28-
fmt.Fprint(a.app.Writer, args...)
28+
_, _ = fmt.Fprint(a.app.Writer, args...)
2929
}
3030

3131
func (a *AppFmt) Println(args ...interface{}) {
32-
fmt.Fprintln(a.app.Writer, args...)
32+
_, _ = fmt.Fprintln(a.app.Writer, args...)
3333
}
3434

3535
func (a *AppFmt) Printf(fmtstr string, args ...interface{}) {
36-
fmt.Fprintf(a.app.Writer, fmtstr, args...)
36+
_, _ = fmt.Fprintf(a.app.Writer, fmtstr, args...)
3737
}
3838

3939
func (a *AppFmt) Scan(args ...interface{}) (int, error) {

cmd/boost/provider_cmd.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,9 @@ var storageAskCmd = &cli.Command{
170170
if err != nil {
171171
return fmt.Errorf("failed to open stream to peer %s: %w", addrInfo.ID, err)
172172
}
173-
defer s.Close()
173+
defer func() {
174+
_ = s.Close()
175+
}()
174176

175177
var resp network.AskResponse
176178

cmd/boost/retrieve_cmd.go

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,9 @@ var retrieveCmd = &cli.Command{
166166
return fmt.Errorf("setting up temp dir: %w", err)
167167
}
168168
// Clean up the temp directory before exiting
169-
defer os.RemoveAll(bstoreTmpDir)
169+
defer func() {
170+
_ = os.RemoveAll(bstoreTmpDir)
171+
}()
170172

171173
bstoreDatastore, err := flatfs.CreateOrOpen(bstoreTmpDir, flatfs.NextToLast(3), false)
172174
bstore := blockstore.NewBlockstore(bstoreDatastore, blockstore.NoPrefix())
@@ -180,7 +182,9 @@ var retrieveCmd = &cli.Command{
180182
return fmt.Errorf("setting up temp dir: %w", err)
181183
}
182184
// Clean up the temp directory before exiting
183-
defer os.RemoveAll(datastoreTmpDir)
185+
defer func() {
186+
_ = os.RemoveAll(datastoreTmpDir)
187+
}()
184188

185189
ds, err := levelds.NewDatastore(datastoreTmpDir, nil)
186190
if err != nil {
@@ -200,7 +204,7 @@ var retrieveCmd = &cli.Command{
200204

201205
proposal, err := rc.RetrievalProposalForAsk(query, c, selNode)
202206
if err != nil {
203-
return fmt.Errorf("Failed to create retrieval proposal with candidate miner %s: %v", miner, err)
207+
return fmt.Errorf("failed to create retrieval proposal with candidate miner %s: %v", miner, err)
204208
}
205209

206210
// Retrieve the data
@@ -213,7 +217,7 @@ var retrieveCmd = &cli.Command{
213217
},
214218
)
215219
if err != nil {
216-
return fmt.Errorf("Failed to retrieve content with candidate miner %s: %v", miner, err)
220+
return fmt.Errorf("failed to retrieve content with candidate miner %s: %v", miner, err)
217221
}
218222

219223
printRetrievalStats(&FILRetrievalStats{RStats: *stats})

cmd/boost/util/evm.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ func getAddressAllowanceOnContract(ctx context.Context, api api.Gateway, wallet
9696
// Parse the contract ABI
9797
parsedABI, err := eabi.JSON(strings.NewReader(contractABI))
9898
if err != nil {
99-
return nil, fmt.Errorf("Failed to parse contract ABI: %w", err)
99+
return nil, fmt.Errorf("failed to parse contract ABI: %w", err)
100100
}
101101

102102
// Convert from Filecoin to Eth Address
@@ -136,7 +136,7 @@ func getAddressAllowanceOnContract(ctx context.Context, api api.Gateway, wallet
136136
}
137137

138138
if result.MsgRct.ExitCode.IsError() {
139-
return nil, fmt.Errorf("Checking allowance failed with ExitCode %d", result.MsgRct.ExitCode)
139+
return nil, fmt.Errorf("checking allowance failed with ExitCode %d", result.MsgRct.ExitCode)
140140
}
141141

142142
// Decode return value (cbor -> evm ABI -> math/big Int -> filecoin big Int)
@@ -157,7 +157,7 @@ func buildTransferViaEVMParams(amount *big.Int, receiverParams []byte) ([]byte,
157157
// Parse the contract's ABI
158158
parsedABI, err := eabi.JSON(strings.NewReader(contractABI))
159159
if err != nil {
160-
return nil, fmt.Errorf("Failed to parse contract ABI: %w", err)
160+
return nil, fmt.Errorf("failed to parse contract ABI: %w", err)
161161
}
162162

163163
// convert amount from Filecoin big.Int to math/big Int

0 commit comments

Comments
 (0)