[golint] fix lint errors

Signed-off-by: Leo Chen <leo@harmony.one>
pull/3493/head
Leo Chen 4 years ago
parent c6ccc403b6
commit 34499c4ab2
  1. 2
      accounts/abi/argument.go
  2. 4
      accounts/abi/bind/backend.go
  3. 1
      accounts/abi/bind/bind.go
  4. 2
      accounts/abi/bind/bind_test.go
  5. 19
      accounts/external/backend.go

@ -31,8 +31,10 @@ type Argument struct {
Indexed bool // indexed is only used by events
}
// Arguments is a list of Argument
type Arguments []Argument
// ArgumentMarshaling is a struct for argument
type ArgumentMarshaling struct {
Name string
Type string

@ -32,11 +32,11 @@ var (
// have any code associated with it (i.e. suicided).
ErrNoCode = errors.New("no contract code at given address")
// This error is raised when attempting to perform a pending state action
// ErrNoPendingState is raised when attempting to perform a pending state action
// on a backend that doesn't implement PendingContractCaller.
ErrNoPendingState = errors.New("backend does not support pending state")
// This error is returned by WaitDeployed if contract creation leaves an
// ErrNoCodeAfterDeploy is returned by WaitDeployed if contract creation leaves an
// empty contract behind.
ErrNoCodeAfterDeploy = errors.New("no contract code after deployment")
)

@ -37,6 +37,7 @@ import (
// Lang is a target programming language selector to generate bindings for.
type Lang int
// Constants
const (
LangGo Lang = iota
LangJava

@ -2186,7 +2186,7 @@ public class Test {
for _, line := range lines {
if strings.TrimSpace(line) != "" {
lines[index] = line
index += 1
index++
}
}
lines = lines[:index]

@ -32,14 +32,17 @@ import (
"github.com/harmony-one/harmony/core/types"
)
// ExternalBackend is a struct for external backend
type ExternalBackend struct {
signers []accounts.Wallet
}
// Wallets returns the list of wallets
func (eb *ExternalBackend) Wallets() []accounts.Wallet {
return eb.signers
}
// NewExternalBackend ...
func NewExternalBackend(endpoint string) (*ExternalBackend, error) {
signer, err := NewExternalSigner(endpoint)
if err != nil {
@ -50,6 +53,7 @@ func NewExternalBackend(endpoint string) (*ExternalBackend, error) {
}, nil
}
// Subscribe ...
func (eb *ExternalBackend) Subscribe(sink chan<- accounts.WalletEvent) event.Subscription {
return event.NewSubscription(func(quit <-chan struct{}) error {
<-quit
@ -68,6 +72,7 @@ type ExternalSigner struct {
cache []accounts.Account
}
// NewExternalSigner ...
func NewExternalSigner(endpoint string) (*ExternalSigner, error) {
client, err := rpc.Dial(endpoint)
if err != nil {
@ -86,6 +91,7 @@ func NewExternalSigner(endpoint string) (*ExternalSigner, error) {
return extsigner, nil
}
// URL ...
func (api *ExternalSigner) URL() accounts.URL {
return accounts.URL{
Scheme: "extapi",
@ -93,18 +99,22 @@ func (api *ExternalSigner) URL() accounts.URL {
}
}
// Status ...
func (api *ExternalSigner) Status() (string, error) {
return api.status, nil
}
// Open ...
func (api *ExternalSigner) Open(passphrase string) error {
return fmt.Errorf("operation not supported on external signers")
}
// Close ...
func (api *ExternalSigner) Close() error {
return fmt.Errorf("operation not supported on external signers")
}
// Accounts ...
func (api *ExternalSigner) Accounts() []accounts.Account {
var accnts []accounts.Account
res, err := api.listAccounts()
@ -127,6 +137,7 @@ func (api *ExternalSigner) Accounts() []accounts.Account {
return accnts
}
// Contains ...
func (api *ExternalSigner) Contains(account accounts.Account) bool {
api.cacheMu.RLock()
defer api.cacheMu.RUnlock()
@ -144,10 +155,12 @@ func (api *ExternalSigner) Contains(account accounts.Account) bool {
return false
}
// Derive ...
func (api *ExternalSigner) Derive(path accounts.DerivationPath, pin bool) (accounts.Account, error) {
return accounts.Account{}, fmt.Errorf("operation not supported on external signers")
}
// SelfDerive ...
func (api *ExternalSigner) SelfDerive(bases []accounts.DerivationPath, chain ethereum.ChainStateReader) {
log.Error("operation SelfDerive not supported on external signers")
}
@ -173,6 +186,7 @@ func (api *ExternalSigner) SignData(account accounts.Account, mimeType string, d
return res, nil
}
// SignText ...
func (api *ExternalSigner) SignText(account accounts.Account, text []byte) ([]byte, error) {
var signature hexutil.Bytes
var signAddress = common.NewMixedcaseAddress(account.Address)
@ -196,6 +210,7 @@ type signTransactionResult struct {
Tx *types.Transaction `json:"tx"`
}
// SignTx ...
func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) {
data := hexutil.Bytes(tx.Data())
var to *common.MixedcaseAddress
@ -219,13 +234,17 @@ func (api *ExternalSigner) SignTx(account accounts.Account, tx *types.Transactio
return res.Tx, nil
}
// SignTextWithPassphrase ...
func (api *ExternalSigner) SignTextWithPassphrase(account accounts.Account, passphrase string, text []byte) ([]byte, error) {
return []byte{}, fmt.Errorf("password-operations not supported on external signers")
}
// SignTxWithPassphrase ...
func (api *ExternalSigner) SignTxWithPassphrase(account accounts.Account, passphrase string, tx *types.Transaction, chainID *big.Int) (*types.Transaction, error) {
return nil, fmt.Errorf("password-operations not supported on external signers")
}
// SignDataWithPassphrase ...
func (api *ExternalSigner) SignDataWithPassphrase(account accounts.Account, passphrase, mimeType string, data []byte) ([]byte, error) {
return nil, fmt.Errorf("password-operations not supported on external signers")
}

Loading…
Cancel
Save