From 7a8404051cb9af015b315284b10189902a9b5648 Mon Sep 17 00:00:00 2001 From: Emmanuel T Odeke Date: Mon, 18 Oct 2021 01:37:55 -0700 Subject: [PATCH] fix: replace reflect.Typeof.Name with fmt.Sprintf("%T") (#10392) 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 --- baseapp/baseapp.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/baseapp/baseapp.go b/baseapp/baseapp.go index 32073cc88..54cb68e74 100644 --- a/baseapp/baseapp.go +++ b/baseapp/baseapp.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "reflect" abci "github.com/tendermint/tendermint/abci/types" "github.com/tendermint/tendermint/libs/log" @@ -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)) } } }