Skip to content

Commit

Permalink
fix: replace reflect.Typeof.Name with fmt.Sprintf("%T") (#10392)
Browse files Browse the repository at this point in the history
Per https://golang.org/pkg/fmt#hdr-Printing, Go's fmt "%T" specifier
prints out the underlying type hence we don't need to invoke
reflect.Typeof(key).Name() just to get it. This change was discovered
while examining Informal Systems' static analyzers that want to flag
certain packages.

Fixes #10391
  • Loading branch information
odeke-em authored Oct 18, 2021
1 parent c0cc052 commit 7a84040
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions baseapp/baseapp.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"context"
"errors"
"fmt"
"reflect"

abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
Expand Down Expand Up @@ -202,7 +201,7 @@ func (app *BaseApp) MountStores(keys ...storetypes.StoreKey) {
app.MountStore(key, storetypes.StoreTypeTransient)

default:
panic("Unrecognized store key type " + reflect.TypeOf(key).Name())
panic(fmt.Sprintf("Unrecognized store key type :%T", key))
}
}
}
Expand Down

0 comments on commit 7a84040

Please sign in to comment.