Skip to content

Commit e0bf5f0

Browse files
gballetfjl
authored andcommitted
internal: fix staticcheck warnings (#20380)
1 parent 1ff3d7c commit e0bf5f0

3 files changed

Lines changed: 27 additions & 14 deletions

File tree

‎internal/cmdtest/test_cmd.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@ func (tt *TestCmd) matchExactOutput(want []byte) error {
127127
// Find the mismatch position.
128128
for i := 0; i < n; i++ {
129129
if want[i] != buf[i] {
130-
return fmt.Errorf("Output mismatch at ◊:\n---------------- (stdout text)\n%s◊%s\n---------------- (expected text)\n%s",
130+
return fmt.Errorf("output mismatch at ◊:\n---------------- (stdout text)\n%s◊%s\n---------------- (expected text)\n%s",
131131
buf[:i], buf[i:n], want)
132132
}
133133
}
134134
if n < len(want) {
135-
return fmt.Errorf("Not enough output, got until ◊:\n---------------- (stdout text)\n%s\n---------------- (expected text)\n%s◊%s",
135+
return fmt.Errorf("not enough output, got until ◊:\n---------------- (stdout text)\n%s\n---------------- (expected text)\n%s◊%s",
136136
buf, want[:n], want[n:])
137137
}
138138
}

‎internal/ethapi/api.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -486,7 +486,7 @@ func (s *PrivateAccountAPI) InitializeWallet(ctx context.Context, url string) (s
486486
case *scwallet.Wallet:
487487
return mnemonic, wallet.Initialize(seed)
488488
default:
489-
return "", fmt.Errorf("Specified wallet does not support initialization")
489+
return "", fmt.Errorf("specified wallet does not support initialization")
490490
}
491491
}
492492

@@ -501,7 +501,7 @@ func (s *PrivateAccountAPI) Unpair(ctx context.Context, url string, pin string)
501501
case *scwallet.Wallet:
502502
return wallet.Unpair([]byte(pin))
503503
default:
504-
return fmt.Errorf("Specified wallet does not support pairing")
504+
return fmt.Errorf("specified wallet does not support pairing")
505505
}
506506
}
507507

@@ -1389,7 +1389,7 @@ func (args *SendTxArgs) setDefaults(ctx context.Context, b Backend) error {
13891389
args.Nonce = (*hexutil.Uint64)(&nonce)
13901390
}
13911391
if args.Data != nil && args.Input != nil && !bytes.Equal(*args.Data, *args.Input) {
1392-
return errors.New(`Both "data" and "input" are set and not equal. Please use "input" to pass transaction call data.`)
1392+
return errors.New(`both "data" and "input" are set and not equal. Please use "input" to pass transaction call data`)
13931393
}
13941394
if args.To == nil {
13951395
// Contract creation
@@ -1645,7 +1645,7 @@ func (s *PublicTransactionPoolAPI) Resend(ctx context.Context, sendArgs SendTxAr
16451645
}
16461646
}
16471647

1648-
return common.Hash{}, fmt.Errorf("Transaction %#x not found", matchTx.Hash())
1648+
return common.Hash{}, fmt.Errorf("transaction %#x not found", matchTx.Hash())
16491649
}
16501650

16511651
// PublicDebugAPI is the collection of Ethereum APIs exposed over the public

‎internal/jsre/deps/bindata.go‎

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
// Code generated by go-bindata. DO NOT EDIT.
1+
// Package deps Code generated by go-bindata. (@generated) DO NOT EDIT.
22
// sources:
33
// bignumber.js
44
// web3.js
5-
65
package deps
76

87
import (
@@ -20,15 +19,15 @@ import (
2019
func bindataRead(data []byte, name string) ([]byte, error) {
2120
gz, err := gzip.NewReader(bytes.NewBuffer(data))
2221
if err != nil {
23-
return nil, fmt.Errorf("Read %q: %v", name, err)
22+
return nil, fmt.Errorf("read %q: %v", name, err)
2423
}
2524

2625
var buf bytes.Buffer
2726
_, err = io.Copy(&buf, gz)
2827
clErr := gz.Close()
2928

3029
if err != nil {
31-
return nil, fmt.Errorf("Read %q: %v", name, err)
30+
return nil, fmt.Errorf("read %q: %v", name, err)
3231
}
3332
if clErr != nil {
3433
return nil, err
@@ -49,21 +48,32 @@ type bindataFileInfo struct {
4948
modTime time.Time
5049
}
5150

51+
// Name return file name
5252
func (fi bindataFileInfo) Name() string {
5353
return fi.name
5454
}
55+
56+
// Size return file size
5557
func (fi bindataFileInfo) Size() int64 {
5658
return fi.size
5759
}
60+
61+
// Mode return file mode
5862
func (fi bindataFileInfo) Mode() os.FileMode {
5963
return fi.mode
6064
}
65+
66+
// ModTime return file modify time
6167
func (fi bindataFileInfo) ModTime() time.Time {
6268
return fi.modTime
6369
}
70+
71+
// IsDir return file whether a directory
6472
func (fi bindataFileInfo) IsDir() bool {
65-
return false
73+
return fi.mode&os.ModeDir != 0
6674
}
75+
76+
// Sys return file is sys mode
6777
func (fi bindataFileInfo) Sys() interface{} {
6878
return nil
6979
}
@@ -161,8 +171,7 @@ func AssetNames() []string {
161171
// _bindata is a table, holding each asset generator, mapped to its name.
162172
var _bindata = map[string]func() (*asset, error){
163173
"bignumber.js": bignumberJs,
164-
165-
"web3.js": web3Js,
174+
"web3.js": web3Js,
166175
}
167176

168177
// AssetDir returns the file names below a certain
@@ -228,7 +237,11 @@ func RestoreAsset(dir, name string) error {
228237
if err != nil {
229238
return err
230239
}
231-
return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
240+
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
241+
if err != nil {
242+
return err
243+
}
244+
return nil
232245
}
233246

234247
// RestoreAssets restores an asset under the given directory recursively

0 commit comments

Comments
 (0)