style: gofumpt linting (#15605)
This commit is contained in:
@@ -20,7 +20,7 @@ func (s *authorizeSuite) Before(t *testing.T) {
|
||||
s.baseFixture = initFixture(t)
|
||||
}
|
||||
|
||||
func (s *authorizeSuite) HasPermission(a string, b string) {
|
||||
func (s *authorizeSuite) HasPermission(a, b string) {
|
||||
panic("PENDING")
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ func (s *authorizeSuite) HasNoPermissions(a string) {
|
||||
panic("PENDING")
|
||||
}
|
||||
|
||||
func (s *authorizeSuite) AttemptsToGrantThePermissions(a string, b string, c gocuke.DocString) {
|
||||
func (s *authorizeSuite) AttemptsToGrantThePermissions(a, b string, c gocuke.DocString) {
|
||||
panic("PENDING")
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ func (s *resetSuite) Before(t *testing.T) {
|
||||
s.baseFixture = initFixture(t)
|
||||
}
|
||||
|
||||
func (s *resetSuite) HasPermission(a string, b string) {
|
||||
func (s *resetSuite) HasPermission(a, b string) {
|
||||
panic("PENDING")
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ func (s *resetSuite) HasNoPermissions(a string) {
|
||||
panic("PENDING")
|
||||
}
|
||||
|
||||
func (s *resetSuite) AttemptsToResetCircuit(a string, b string, c gocuke.DocString) {
|
||||
func (s *resetSuite) AttemptsToResetCircuit(a, b string, c gocuke.DocString) {
|
||||
panic("PENDING")
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ func (s *tripSuite) Before(t *testing.T) {
|
||||
s.baseFixture = initFixture(t)
|
||||
}
|
||||
|
||||
func (s *tripSuite) HasPermission(a string, b string) {
|
||||
func (s *tripSuite) HasPermission(a, b string) {
|
||||
panic("PENDING")
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ func (s *tripSuite) HasNoPermissions(a string) {
|
||||
panic("PENDING")
|
||||
}
|
||||
|
||||
func (s *tripSuite) AttemptsToTripCircuit(a string, b string, c gocuke.DocString) {
|
||||
func (s *tripSuite) AttemptsToTripCircuit(a, b string, c gocuke.DocString) {
|
||||
panic("PENDING")
|
||||
}
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ func (k Keeper) AllEvidence(c context.Context, req *types.QueryAllEvidenceReques
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
evidenceStore := prefix.NewStore(store, types.KeyPrefixEvidence)
|
||||
|
||||
pageRes, err := query.Paginate(evidenceStore, req.Pagination, func(key []byte, value []byte) error {
|
||||
pageRes, err := query.Paginate(evidenceStore, req.Pagination, func(key, value []byte) error {
|
||||
result, err := k.UnmarshalEvidence(value)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
@@ -78,7 +78,7 @@ func (q Keeper) Allowances(c context.Context, req *feegrant.QueryAllowancesReque
|
||||
store := ctx.KVStore(q.storeKey)
|
||||
grantsStore := prefix.NewStore(store, feegrant.FeeAllowancePrefixByGrantee(granteeAddr))
|
||||
|
||||
pageRes, err := query.Paginate(grantsStore, req.Pagination, func(key []byte, value []byte) error {
|
||||
pageRes, err := query.Paginate(grantsStore, req.Pagination, func(key, value []byte) error {
|
||||
var grant feegrant.Grant
|
||||
|
||||
if err := q.cdc.Unmarshal(value, &grant); err != nil {
|
||||
|
||||
@@ -162,7 +162,7 @@ func (k Keeper) GetAllowance(ctx sdk.Context, granter, grantee sdk.AccAddress) (
|
||||
}
|
||||
|
||||
// getGrant returns entire grant between both accounts
|
||||
func (k Keeper) getGrant(ctx sdk.Context, granter sdk.AccAddress, grantee sdk.AccAddress) (*feegrant.Grant, error) {
|
||||
func (k Keeper) getGrant(ctx sdk.Context, granter, grantee sdk.AccAddress) (*feegrant.Grant, error) {
|
||||
store := ctx.KVStore(k.storeKey)
|
||||
key := feegrant.FeeAllowanceKey(granter, grantee)
|
||||
bz := store.Get(key)
|
||||
|
||||
+1
-1
@@ -36,7 +36,7 @@ var (
|
||||
//
|
||||
// Key format:
|
||||
// - <0x00><len(grantee_address_bytes)><grantee_address_bytes><len(granter_address_bytes)><granter_address_bytes>
|
||||
func FeeAllowanceKey(granter sdk.AccAddress, grantee sdk.AccAddress) []byte {
|
||||
func FeeAllowanceKey(granter, grantee sdk.AccAddress) []byte {
|
||||
return append(FeeAllowancePrefixByGrantee(grantee), address.MustLengthPrefix(granter.Bytes())...)
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ func FeeAllowancePrefixQueue(exp *time.Time, granterAddrBz []byte) []byte {
|
||||
//
|
||||
// Key format:
|
||||
// - <0x00><len(grantee_address_bytes)><grantee_address_bytes><len(granter_address_bytes)><granter_address_bytes>
|
||||
func FeeAllowanceKey(granter sdk.AccAddress, grantee sdk.AccAddress) []byte {
|
||||
func FeeAllowanceKey(granter, grantee sdk.AccAddress) []byte {
|
||||
return append(FeeAllowancePrefixByGrantee(grantee), address.MustLengthPrefix(granter.Bytes())...)
|
||||
}
|
||||
|
||||
|
||||
+1
-2
@@ -75,13 +75,12 @@ func (msg MsgGrantAllowance) UnpackInterfaces(unpacker types.AnyUnpacker) error
|
||||
// granter and grantee
|
||||
//
|
||||
//nolint:interfacer
|
||||
func NewMsgRevokeAllowance(granter sdk.AccAddress, grantee sdk.AccAddress) MsgRevokeAllowance {
|
||||
func NewMsgRevokeAllowance(granter, grantee sdk.AccAddress) MsgRevokeAllowance {
|
||||
return MsgRevokeAllowance{Granter: granter.String(), Grantee: grantee.String()}
|
||||
}
|
||||
|
||||
// ValidateBasic implements the sdk.Msg interface.
|
||||
func (msg MsgRevokeAllowance) ValidateBasic() error {
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -89,7 +89,7 @@ func (k Keeper) NFTs(goCtx context.Context, r *nft.QueryNFTsRequest) (*nft.Query
|
||||
|
||||
switch {
|
||||
case len(r.ClassId) > 0 && len(r.Owner) > 0:
|
||||
if pageRes, err = query.Paginate(k.getClassStoreByOwner(ctx, owner, r.ClassId), r.Pagination, func(key []byte, _ []byte) error {
|
||||
if pageRes, err = query.Paginate(k.getClassStoreByOwner(ctx, owner, r.ClassId), r.Pagination, func(key, _ []byte) error {
|
||||
nft, has := k.GetNFT(ctx, r.ClassId, string(key))
|
||||
if has {
|
||||
nfts = append(nfts, &nft)
|
||||
@@ -100,7 +100,7 @@ func (k Keeper) NFTs(goCtx context.Context, r *nft.QueryNFTsRequest) (*nft.Query
|
||||
}
|
||||
case len(r.ClassId) > 0 && len(r.Owner) == 0:
|
||||
nftStore := k.getNFTStore(ctx, r.ClassId)
|
||||
if pageRes, err = query.Paginate(nftStore, r.Pagination, func(_ []byte, value []byte) error {
|
||||
if pageRes, err = query.Paginate(nftStore, r.Pagination, func(_, value []byte) error {
|
||||
var nft nft.NFT
|
||||
if err := k.cdc.Unmarshal(value, &nft); err != nil {
|
||||
return err
|
||||
@@ -111,7 +111,7 @@ func (k Keeper) NFTs(goCtx context.Context, r *nft.QueryNFTsRequest) (*nft.Query
|
||||
return nil, err
|
||||
}
|
||||
case len(r.ClassId) == 0 && len(r.Owner) > 0:
|
||||
if pageRes, err = query.Paginate(k.prefixStoreNftOfClassByOwner(ctx, owner), r.Pagination, func(key []byte, value []byte) error {
|
||||
if pageRes, err = query.Paginate(k.prefixStoreNftOfClassByOwner(ctx, owner), r.Pagination, func(key, value []byte) error {
|
||||
classID, nftID := parseNftOfClassByOwnerStoreKey(key)
|
||||
if n, has := k.GetNFT(ctx, classID, nftID); has {
|
||||
nfts = append(nfts, &n)
|
||||
@@ -179,7 +179,7 @@ func (k Keeper) Classes(goCtx context.Context, r *nft.QueryClassesRequest) (*nft
|
||||
classStore := prefix.NewStore(runtime.KVStoreAdapter(store), ClassKey)
|
||||
|
||||
var classes []*nft.Class
|
||||
pageRes, err := query.Paginate(classStore, r.Pagination, func(_ []byte, value []byte) error {
|
||||
pageRes, err := query.Paginate(classStore, r.Pagination, func(_, value []byte) error {
|
||||
var class nft.Class
|
||||
if err := k.cdc.Unmarshal(value, &class); err != nil {
|
||||
return err
|
||||
|
||||
+2
-2
@@ -42,7 +42,7 @@ func (k Keeper) mintWithNoCheck(ctx context.Context, token nft.NFT, receiver sdk
|
||||
|
||||
// Burn defines a method for burning a nft from a specific account.
|
||||
// Note: When the upper module uses this method, it needs to authenticate nft
|
||||
func (k Keeper) Burn(ctx context.Context, classID string, nftID string) error {
|
||||
func (k Keeper) Burn(ctx context.Context, classID, nftID string) error {
|
||||
if !k.HasClass(ctx, classID) {
|
||||
return errors.Wrap(nft.ErrClassNotExists, classID)
|
||||
}
|
||||
@@ -58,7 +58,7 @@ func (k Keeper) Burn(ctx context.Context, classID string, nftID string) error {
|
||||
// burnWithNoCheck defines a method for burning a nft from a specific account.
|
||||
// Note: this method does not check whether the class already exists in nft.
|
||||
// The upper-layer application needs to check it when it needs to use it
|
||||
func (k Keeper) burnWithNoCheck(ctx context.Context, classID string, nftID string) error {
|
||||
func (k Keeper) burnWithNoCheck(ctx context.Context, classID, nftID string) error {
|
||||
owner := k.GetOwner(ctx, classID, nftID)
|
||||
nftStore := k.getNFTStore(ctx, classID)
|
||||
nftStore.Delete([]byte(nftID))
|
||||
|
||||
@@ -6,6 +6,4 @@ const (
|
||||
txCodespace = "tx"
|
||||
)
|
||||
|
||||
var (
|
||||
ErrUnknownField = errors.Register(txCodespace, 2, "unknown protobuf field")
|
||||
)
|
||||
var ErrUnknownField = errors.Register(txCodespace, 2, "unknown protobuf field")
|
||||
|
||||
@@ -14,13 +14,15 @@ import (
|
||||
|
||||
const bit11NonCritical = 1 << 10
|
||||
|
||||
var anyDesc = (&anypb.Any{}).ProtoReflect().Descriptor()
|
||||
var anyFullName = anyDesc.FullName()
|
||||
var (
|
||||
anyDesc = (&anypb.Any{}).ProtoReflect().Descriptor()
|
||||
anyFullName = anyDesc.FullName()
|
||||
)
|
||||
|
||||
// RejectUnknownFieldsStrict operates by the same rules as RejectUnknownFields, but returns an error if any unknown
|
||||
// non-critical fields are encountered.
|
||||
func RejectUnknownFieldsStrict(bz []byte, msg protoreflect.MessageDescriptor, resolver protodesc.Resolver) error {
|
||||
var _, err = RejectUnknownFields(bz, msg, false, resolver)
|
||||
_, err := RejectUnknownFields(bz, msg, false, resolver)
|
||||
return err
|
||||
}
|
||||
|
||||
|
||||
@@ -640,8 +640,8 @@ func TestRejectUnknownFieldsFlat(t *testing.T) {
|
||||
|
||||
c1 := new(testpb.Customer1)
|
||||
c1Desc := c1.ProtoReflect().Descriptor()
|
||||
//err = proto.Unmarshal(blob, c1)
|
||||
//require.NoError(t, err)
|
||||
// err = proto.Unmarshal(blob, c1)
|
||||
// require.NoError(t, err)
|
||||
gotErr := decode.RejectUnknownFieldsStrict(blob, c1Desc, ProtoResolver)
|
||||
if tt.wantErr != nil {
|
||||
require.EqualError(t, gotErr, tt.wantErr.Error())
|
||||
|
||||
@@ -22,7 +22,7 @@ const (
|
||||
majorSimple byte = 7
|
||||
)
|
||||
|
||||
func encodeFirstByte(major byte, extra byte) byte {
|
||||
func encodeFirstByte(major, extra byte) byte {
|
||||
return (major << 5) | extra&0x1F
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user