Skip to content

Commit

Permalink
internal: fix staticcheck warnings (ethereum#20380)
Browse files Browse the repository at this point in the history
  • Loading branch information
gballet authored and enriquefynn committed Feb 15, 2021
1 parent f248228 commit 9da9adb
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 14 deletions.
4 changes: 2 additions & 2 deletions internal/cmdtest/test_cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,12 @@ func (tt *TestCmd) matchExactOutput(want []byte) error {
// Find the mismatch position.
for i := 0; i < n; i++ {
if want[i] != buf[i] {
return fmt.Errorf("Output mismatch at ◊:\n---------------- (stdout text)\n%s◊%s\n---------------- (expected text)\n%s",
return fmt.Errorf("output mismatch at ◊:\n---------------- (stdout text)\n%s◊%s\n---------------- (expected text)\n%s",
buf[:i], buf[i:n], want)
}
}
if n < len(want) {
return fmt.Errorf("Not enough output, got until ◊:\n---------------- (stdout text)\n%s\n---------------- (expected text)\n%s◊%s",
return fmt.Errorf("not enough output, got until ◊:\n---------------- (stdout text)\n%s\n---------------- (expected text)\n%s◊%s",
buf, want[:n], want[n:])
}
}
Expand Down
8 changes: 4 additions & 4 deletions internal/ethapi/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,7 +486,7 @@ func (s *PrivateAccountAPI) InitializeWallet(ctx context.Context, url string) (s
case *scwallet.Wallet:
return mnemonic, wallet.Initialize(seed)
default:
return "", fmt.Errorf("Specified wallet does not support initialization")
return "", fmt.Errorf("specified wallet does not support initialization")
}
}

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

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

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

// PublicDebugAPI is the collection of Ethereum APIs exposed over the public
Expand Down
29 changes: 21 additions & 8 deletions internal/jsre/deps/bindata.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
// Code generated by go-bindata. DO NOT EDIT.
// Package deps Code generated by go-bindata. (@generated) DO NOT EDIT.
// sources:
// bignumber.js
// web3.js

package deps

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

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

if err != nil {
return nil, fmt.Errorf("Read %q: %v", name, err)
return nil, fmt.Errorf("read %q: %v", name, err)
}
if clErr != nil {
return nil, err
Expand All @@ -49,21 +48,32 @@ type bindataFileInfo struct {
modTime time.Time
}

// Name return file name
func (fi bindataFileInfo) Name() string {
return fi.name
}

// Size return file size
func (fi bindataFileInfo) Size() int64 {
return fi.size
}

// Mode return file mode
func (fi bindataFileInfo) Mode() os.FileMode {
return fi.mode
}

// ModTime return file modify time
func (fi bindataFileInfo) ModTime() time.Time {
return fi.modTime
}

// IsDir return file whether a directory
func (fi bindataFileInfo) IsDir() bool {
return false
return fi.mode&os.ModeDir != 0
}

// Sys return file is sys mode
func (fi bindataFileInfo) Sys() interface{} {
return nil
}
Expand Down Expand Up @@ -161,8 +171,7 @@ func AssetNames() []string {
// _bindata is a table, holding each asset generator, mapped to its name.
var _bindata = map[string]func() (*asset, error){
"bignumber.js": bignumberJs,

"web3.js": web3Js,
"web3.js": web3Js,
}

// AssetDir returns the file names below a certain
Expand Down Expand Up @@ -228,7 +237,11 @@ func RestoreAsset(dir, name string) error {
if err != nil {
return err
}
return os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
err = os.Chtimes(_filePath(dir, name), info.ModTime(), info.ModTime())
if err != nil {
return err
}
return nil
}

// RestoreAssets restores an asset under the given directory recursively
Expand Down

0 comments on commit 9da9adb

Please sign in to comment.