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
This commit is contained in:
Emmanuel T Odeke 2021-10-18 01:37:55 -07:00 committed by GitHub
parent c0cc0529c4
commit 7a8404051c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

View File

@ -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))
}
}
}