Skip to content

Commit

Permalink
chore: run goimportssort over the repo (#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
owen-reorg authored Feb 10, 2023
1 parent 7783af4 commit 6dbd5f0
Show file tree
Hide file tree
Showing 74 changed files with 200 additions and 118 deletions.
19 changes: 19 additions & 0 deletions .golangci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
linters:
enable:
- gofmt
- goimports
- errcheck
- govet
- staticcheck

linters-settings:
gofmt:
# Simplify code: gofmt with `-s` option.
# Default: true
simplify: true
# Apply the rewrite rules to the source before reformatting.
# https://pkg.go.dev/cmd/gofmt
# Default: []
rewrite-rules:
- pattern: 'a[b:len(a)]'
replacement: 'a[b:]'
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ ldflags = -X $(REPO)/version.AppVersion=$(VERSION) \
-X $(REPO)/version.GitCommitDate=$(GIT_COMMIT_DATE)

format:
bash format.sh
bash scripts/format.sh

tools:
curl https://get.ignite.com/cli! | bash
Expand Down
7 changes: 3 additions & 4 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,12 @@ import (
bridgemodule "github.com/bnb-chain/greenfield/x/bridge"
bridgemodulekeeper "github.com/bnb-chain/greenfield/x/bridge/keeper"
bridgemoduletypes "github.com/bnb-chain/greenfield/x/bridge/types"
spmodule "github.com/bnb-chain/greenfield/x/sp"
spmodulekeeper "github.com/bnb-chain/greenfield/x/sp/keeper"
spmoduletypes "github.com/bnb-chain/greenfield/x/sp/types"

paymentmodule "github.com/bnb-chain/greenfield/x/payment"
paymentmodulekeeper "github.com/bnb-chain/greenfield/x/payment/keeper"
paymentmoduletypes "github.com/bnb-chain/greenfield/x/payment/types"
spmodule "github.com/bnb-chain/greenfield/x/sp"
spmodulekeeper "github.com/bnb-chain/greenfield/x/sp/keeper"
spmoduletypes "github.com/bnb-chain/greenfield/x/sp/types"
storagemodule "github.com/bnb-chain/greenfield/x/storage"
storagemodulekeeper "github.com/bnb-chain/greenfield/x/storage/keeper"
storagemoduletypes "github.com/bnb-chain/greenfield/x/storage/types"
Expand Down
10 changes: 0 additions & 10 deletions format.sh

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ require (

replace (
github.com/confio/ics23/go => github.com/cosmos/cosmos-sdk/ics23/go v0.8.0
github.com/cosmos/cosmos-sdk => github.com/bnb-chain/gnfd-cosmos-sdk v0.0.2-0.20230209090945-5a119caf6b3e
github.com/cosmos/cosmos-sdk => github.com/bnb-chain/gnfd-cosmos-sdk v0.0.2-0.20230210033000-9e761ce1485e
github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1
github.com/tendermint/tendermint => github.com/bnb-chain/gnfd-tendermint v0.0.1
)
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -218,8 +218,8 @@ github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdn
github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk=
github.com/bmizerany/assert v0.0.0-20160611221934-b7ed37b82869/go.mod h1:Ekp36dRnpXw/yCqJaO+ZrUyxD+3VXMFFr56k5XYrpB4=
github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c=
github.com/bnb-chain/gnfd-cosmos-sdk v0.0.2-0.20230209090945-5a119caf6b3e h1:w2B9A4FlZ24MEtPIcWA6T4tKvCMBSiaYPIT0dkk6wh0=
github.com/bnb-chain/gnfd-cosmos-sdk v0.0.2-0.20230209090945-5a119caf6b3e/go.mod h1:NlIOmju3uhTOJ2YAzLPidpmh7sAgJ+J9dkUlSysHmjw=
github.com/bnb-chain/gnfd-cosmos-sdk v0.0.2-0.20230210033000-9e761ce1485e h1:9IpmZ88MOSBzowmLnVEOuTN8/7npXyjsEAuubhOViTU=
github.com/bnb-chain/gnfd-cosmos-sdk v0.0.2-0.20230210033000-9e761ce1485e/go.mod h1:NlIOmju3uhTOJ2YAzLPidpmh7sAgJ+J9dkUlSysHmjw=
github.com/bnb-chain/gnfd-tendermint v0.0.1 h1:KWFuxWv8m6t1vUi3ADyVcEG0qVnEzQt1tjA6dk/b7+Q=
github.com/bnb-chain/gnfd-tendermint v0.0.1/go.mod h1:/v9z9F6cq0+f7EGG92lYSLBcPYQDILoK91X8YM28hWo=
github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps=
Expand Down
11 changes: 11 additions & 0 deletions scripts/format.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

which goimportssort || go install github.com/AanZee/goimportssort

for entry in `find . -name "*.go" | grep -v '.pb.'`; do
echo $entry
if grep -q "DO NOT EDIT" "$entry"; then
continue
fi
goimportssort -w -local github.com/bnb-chain/ $entry
done
17 changes: 9 additions & 8 deletions testutil/keeper/payment.go
Original file line number Diff line number Diff line change
@@ -1,28 +1,29 @@
package keeper

import (
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/authz"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
"math/rand"
"testing"

"github.com/bnb-chain/greenfield/x/payment/keeper"
"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/codec"
codectypes "github.com/cosmos/cosmos-sdk/codec/types"
"github.com/cosmos/cosmos-sdk/store"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/authz"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
typesparams "github.com/cosmos/cosmos-sdk/x/params/types"
"github.com/stretchr/testify/require"
"github.com/tendermint/tendermint/libs/log"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmdb "github.com/tendermint/tm-db"

"github.com/bnb-chain/greenfield/x/payment/keeper"
"github.com/bnb-chain/greenfield/x/payment/types"
)

func PaymentKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) {
Expand Down
6 changes: 1 addition & 5 deletions x/payment/client/cli/query.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,9 @@ package cli

import (
"fmt"
// "strings"

"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
// "github.com/cosmos/cosmos-sdk/client/flags"
// sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)
Expand Down
3 changes: 2 additions & 1 deletion x/payment/client/cli/query_auto_settle_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package cli
import (
"context"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cast"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

func CmdListAutoSettleRecord() *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion x/payment/client/cli/query_bnb_price.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package cli
import (
"context"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cast"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

func CmdListBnbPrice() *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion x/payment/client/cli/query_dynamic_balance.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package cli
import (
"strconv"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

var _ = strconv.Itoa(0)
Expand Down
3 changes: 2 additions & 1 deletion x/payment/client/cli/query_get_payment_accounts_by_owner.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package cli
import (
"strconv"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

var _ = strconv.Itoa(0)
Expand Down
3 changes: 2 additions & 1 deletion x/payment/client/cli/query_mock_bucket_meta.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package cli
import (
"context"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

func CmdListMockBucketMeta() *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion x/payment/client/cli/query_mock_object_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package cli
import (
"context"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

func CmdListMockObjectInfo() *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion x/payment/client/cli/query_params.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package cli
import (
"context"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

func CmdQueryParams() *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion x/payment/client/cli/query_payment_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package cli
import (
"context"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

func CmdListPaymentAccount() *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion x/payment/client/cli/query_payment_account_count.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package cli
import (
"context"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

func CmdListPaymentAccountCount() *cobra.Command {
Expand Down
3 changes: 2 additions & 1 deletion x/payment/client/cli/query_stream_record.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ package cli
import (
"context"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

func CmdListStreamRecord() *cobra.Command {
Expand Down
3 changes: 1 addition & 2 deletions x/payment/client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ import (
"fmt"
"time"

"github.com/cosmos/cosmos-sdk/client"
"github.com/spf13/cobra"

"github.com/cosmos/cosmos-sdk/client"
// "github.com/cosmos/cosmos-sdk/client/flags"
"github.com/bnb-chain/greenfield/x/payment/types"
)

Expand Down
3 changes: 2 additions & 1 deletion x/payment/client/cli/tx_create_payment_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package cli
import (
"strconv"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

var _ = strconv.Itoa(0)
Expand Down
5 changes: 3 additions & 2 deletions x/payment/client/cli/tx_deposit.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package cli

import (
sdkmath "cosmossdk.io/math"
"fmt"
"strconv"

"github.com/bnb-chain/greenfield/x/payment/types"
sdkmath "cosmossdk.io/math"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

var _ = strconv.Itoa(0)
Expand Down
3 changes: 2 additions & 1 deletion x/payment/client/cli/tx_disable_refund.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package cli
import (
"strconv"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

var _ = strconv.Itoa(0)
Expand Down
3 changes: 2 additions & 1 deletion x/payment/client/cli/tx_mock_create_bucket.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package cli
import (
"strconv"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

var _ = strconv.Itoa(0)
Expand Down
3 changes: 2 additions & 1 deletion x/payment/client/cli/tx_mock_delete_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@ package cli
import (
"strconv"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

var _ = strconv.Itoa(0)
Expand Down
3 changes: 2 additions & 1 deletion x/payment/client/cli/tx_mock_put_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ package cli
import (
"strconv"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cast"
"github.com/spf13/cobra"

"github.com/bnb-chain/greenfield/x/payment/types"
)

var _ = strconv.Itoa(0)
Expand Down
5 changes: 3 additions & 2 deletions x/payment/client/cli/tx_mock_seal_object.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@ package cli

import (
"strconv"
"strings"

"github.com/bnb-chain/greenfield/x/payment/types"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/spf13/cobra"
"strings"

"github.com/bnb-chain/greenfield/x/payment/types"
)

var _ = strconv.Itoa(0)
Expand Down
Loading

0 comments on commit 6dbd5f0

Please sign in to comment.