Skip to content

Commit

Permalink
style: fixing linting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
themantre committed Sep 30, 2023
1 parent 4521a76 commit 019df0b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 7 deletions.
1 change: 0 additions & 1 deletion util/logger/logger.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ func addFields(event *zerolog.Event, keyvals ...interface{}) *zerolog.Event {
event.Str(key, fmt.Sprintf("%v", hex.EncodeToString(v)))
default:
event.Any(key, v)

}
}
return event
Expand Down
5 changes: 4 additions & 1 deletion util/logger/logger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,10 @@ func TestNilValue(t *testing.T) {
log.Logger = log.Output(&buf)

foo := new(Foo)
foo = nil
if true {
// to avoid some linting errors
foo = nil
}

Info("msg", "null", nil)
Info("msg", "error", error(nil))
Expand Down
6 changes: 3 additions & 3 deletions wallet/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ func (e CRCNotMatchError) Error() string {
return fmt.Sprintf("crc not matched, expected: %d, got: %d", e.Expected, e.Got)
}

// WalletExitsError describes an error in which a wallet exists in the
// ExitsError describes an error in which a wallet exists in the
// given path.
type WalletExitsError struct { //nolint
type ExitsError struct {
Path string
}

func (e WalletExitsError) Error() string {
func (e ExitsError) Error() string {
return fmt.Sprintf("a wallet exists at: %s", e.Path)
}
2 changes: 1 addition & 1 deletion wallet/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func Open(path string, offline bool) (*Wallet, error) {
func Create(path, mnemonic, password string, chain genesis.ChainType) (*Wallet, error) {
path = util.MakeAbs(path)
if util.PathExists(path) {
return nil, WalletExitsError{
return nil, ExitsError{
Path: path,
}
}
Expand Down
2 changes: 1 addition & 1 deletion wallet/wallet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ func TestRecoverWallet(t *testing.T) {
assert.NoError(t, td.wallet.Save())

_, err := Create(td.wallet.path, mnemonic, password, 0)
assert.ErrorIs(t, err, WalletExitsError{
assert.ErrorIs(t, err, ExitsError{
Path: td.wallet.path,
})
})
Expand Down

0 comments on commit 019df0b

Please sign in to comment.