Skip to content

Commit

Permalink
style: format code
Browse files Browse the repository at this point in the history
  • Loading branch information
zakir-code committed May 25, 2023
1 parent bdc4433 commit 77055a6
Show file tree
Hide file tree
Showing 41 changed files with 158 additions and 212 deletions.
13 changes: 13 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
run:
# Timeout for analysis, e.g. 30s, 5m.
# Default: 1m
timeout: 5m

# Include test files or not.
# Default: true
tests: true

# Define the Go version limit.
# Mainly related to generics support since go1.18.
# Default: use Go version from the go.mod file, fallback on the env var `GOVERSION`, fallback on 1.18
go: '1.18'
16 changes: 12 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,20 @@ draw-deps:

lint:
@echo "--> Running linter"
golangci-lint run -v --timeout 5m
@go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest
@go install mvdan.cc/gofumpt@latest
golangci-lint run -v --go=1.18 --timeout 10m
find . -name '*.go' -type f -not -path "./build*" -not -name "statik.go" -not -name "*.pb.go" -not -name "*.pb.gw.go" | xargs gofumpt -d

format:
find . -name '*.go' -type f -not -path "./vendor*" -not -path "./build*" -not -path "*.git*" -not -path "./docs/statik/statik.go" -not -name "*.pb.go" -not -name "*.pb.gw.go" -not -name "*.pulsar.go" -not -path "./crypto/keys/secp256k1/*" | xargs gofumpt -w -l
format: format-goimports
find . -name '*.go' -type f -not -path "./build*" -not -name "statik.go" -not -name "*.pb.go" -not -name "*.pb.gw.go" | xargs gofumpt -w -l
golangci-lint run --fix
.PHONY: format

format-goimports:
@go install github.com/incu6us/goimports-reviser/v3@latest
@find . -name '*.go' -type f -not -path './build*' -not -name 'statik.go' -not -name '*.pb.go' -not -name '*.pb.gw.go' -exec goimports-reviser -use-cache -rm-unused {} \;

.PHONY: format lint

###############################################################################
### Tests & Simulation ###
Expand Down
35 changes: 14 additions & 21 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,6 @@ import (
"os"
"path/filepath"

"github.com/pundix/pundix/server/grpc/base/gasprice"
gaspricelegacy "github.com/pundix/pundix/server/grpc/base/gasprice/legacy"

stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"

"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/x/auth/ante"

pundixante "github.com/pundix/pundix/ante"
"github.com/pundix/pundix/app/keepers"
appparams "github.com/pundix/pundix/app/params"
"github.com/pundix/pundix/app/upgrades"
v2 "github.com/pundix/pundix/app/upgrades/v2"

"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
Expand All @@ -33,27 +16,37 @@ import (
"github.com/cosmos/cosmos-sdk/server/api"
"github.com/cosmos/cosmos-sdk/server/config"
servertypes "github.com/cosmos/cosmos-sdk/server/types"
"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth/ante"
authrest "github.com/cosmos/cosmos-sdk/x/auth/client/rest"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/crisis"
govtypes "github.com/cosmos/cosmos-sdk/x/gov/types"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ibctesting "github.com/cosmos/ibc-go/v3/testing"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"
"github.com/spf13/cast"
abci "github.com/tendermint/tendermint/abci/types"
tmjson "github.com/tendermint/tendermint/libs/json"
"github.com/tendermint/tendermint/libs/log"
tmos "github.com/tendermint/tendermint/libs/os"
dbm "github.com/tendermint/tm-db"

pxtypes "github.com/pundix/pundix/types"

ibctesting "github.com/cosmos/ibc-go/v3/testing"

pundixante "github.com/pundix/pundix/ante"
"github.com/pundix/pundix/app/keepers"
appparams "github.com/pundix/pundix/app/params"
"github.com/pundix/pundix/app/upgrades"
v2 "github.com/pundix/pundix/app/upgrades/v2"
_ "github.com/pundix/pundix/docs/statik"
"github.com/pundix/pundix/server/grpc/base/gasprice"
gaspricelegacy "github.com/pundix/pundix/server/grpc/base/gasprice/legacy"
pxtypes "github.com/pundix/pundix/types"
)

var (
Expand Down
3 changes: 1 addition & 2 deletions app/cli/add_genesis_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import (
"errors"
"fmt"

cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
Expand Down
3 changes: 1 addition & 2 deletions app/cli/block.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,11 @@ import (
"os"
"strconv"

"gopkg.in/yaml.v2"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/spf13/cobra"
tmcli "github.com/tendermint/tendermint/libs/cli"
"gopkg.in/yaml.v2"
)

// BlockCommand returns the verified block data for a given heights
Expand Down
7 changes: 3 additions & 4 deletions app/cli/block_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import (
"encoding/json"
"strconv"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/gogo/protobuf/proto"
"github.com/tendermint/tendermint/abci/types"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/gogo/protobuf/proto"
"github.com/spf13/cobra"
"github.com/tendermint/tendermint/abci/types"
coretypes "github.com/tendermint/tendermint/rpc/core/types"
)

Expand Down
12 changes: 5 additions & 7 deletions app/cli/collect_gentx.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,19 @@ import (
"runtime"
"strings"

cfg "github.com/tendermint/tendermint/config"
tmtypes "github.com/tendermint/tendermint/types"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
bankexported "github.com/cosmos/cosmos-sdk/x/bank/exported"
"github.com/cosmos/cosmos-sdk/x/genutil"
"github.com/cosmos/cosmos-sdk/x/genutil/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/x/genutil"
"github.com/pkg/errors"
"github.com/spf13/cobra"
cfg "github.com/tendermint/tendermint/config"
tmtypes "github.com/tendermint/tendermint/types"
)

const flagGenTxDir = "gentx-dir"
Expand Down
4 changes: 2 additions & 2 deletions app/cli/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ import (
"path/filepath"
"strings"

appparams "github.com/pundix/pundix/app/params"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/server/config"
Expand All @@ -15,6 +13,8 @@ import (
"github.com/spf13/viper"
tmcfg "github.com/tendermint/tendermint/config"
tmcli "github.com/tendermint/tendermint/libs/cli"

appparams "github.com/pundix/pundix/app/params"
)

const (
Expand Down
5 changes: 2 additions & 3 deletions app/cli/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,14 @@ import (
"time"

"github.com/cosmos/cosmos-sdk/server"
"github.com/spf13/cobra"
"github.com/spf13/viper"
"github.com/syndtr/goleveldb/leveldb/util"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/node"
sm "github.com/tendermint/tendermint/state"
"github.com/tendermint/tendermint/store"
dbm "github.com/tendermint/tm-db"

"github.com/spf13/cobra"
"github.com/spf13/viper"
)

const (
Expand Down
21 changes: 8 additions & 13 deletions app/cli/debug.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,21 @@ import (
"fmt"
"strings"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/debug"
tmcli "github.com/tendermint/tendermint/libs/cli"

"github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"

// nolint
"github.com/cosmos/cosmos-sdk/types/bech32/legacybech32"

cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/server"
"github.com/tendermint/tendermint/privval"

"github.com/cosmos/cosmos-sdk/client"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/bech32/legacybech32" // nolint
"github.com/cosmos/cosmos-sdk/version"
"github.com/cosmos/cosmos-sdk/x/auth/legacy/legacytx"
authsigning "github.com/cosmos/cosmos-sdk/x/auth/signing"
"github.com/cosmos/cosmos-sdk/x/auth/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/spf13/cobra"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/privval"
)

func Debug() *cobra.Command {
Expand Down
8 changes: 3 additions & 5 deletions app/cli/export_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@ import (
"os"
"path/filepath"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/server"

"github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/spf13/cobra"
tmjson "github.com/tendermint/tendermint/libs/json"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmtypes "github.com/tendermint/tendermint/types"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
)

const (
Expand Down
14 changes: 6 additions & 8 deletions app/cli/gentx.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,26 +9,24 @@ import (
"os"
"path/filepath"

sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"

types2 "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/pkg/errors"
"github.com/spf13/cobra"
tmos "github.com/tendermint/tendermint/libs/os"
tmtypes "github.com/tendermint/tendermint/types"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/tx"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/version"
authclient "github.com/cosmos/cosmos-sdk/x/auth/client"
"github.com/cosmos/cosmos-sdk/x/genutil"
"github.com/cosmos/cosmos-sdk/x/genutil/types"
"github.com/cosmos/cosmos-sdk/x/staking/client/cli"
types2 "github.com/cosmos/cosmos-sdk/x/staking/types"
"github.com/pkg/errors"
"github.com/spf13/cobra"
tmos "github.com/tendermint/tendermint/libs/os"
tmtypes "github.com/tendermint/tendermint/types"
)

// GenTxCmd builds the application's gentx command.
Expand Down
5 changes: 2 additions & 3 deletions app/cli/query_store.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import (
"encoding/hex"
"fmt"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/x/staking/types"

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

Expand Down
5 changes: 2 additions & 3 deletions app/cli/query_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import (
"fmt"
"strings"

"github.com/spf13/cobra"
tmtypes "github.com/tendermint/tendermint/types"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand All @@ -15,6 +12,8 @@ import (
"github.com/cosmos/cosmos-sdk/types/rest"
"github.com/cosmos/cosmos-sdk/version"
authtx "github.com/cosmos/cosmos-sdk/x/auth/tx"
"github.com/spf13/cobra"
tmtypes "github.com/tendermint/tendermint/types"
)

const (
Expand Down
10 changes: 4 additions & 6 deletions app/cli/status.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,15 @@ import (
"strconv"
"time"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/spf13/cobra"

"github.com/tendermint/tendermint/libs/bytes"
tmcli "github.com/tendermint/tendermint/libs/cli"
"github.com/tendermint/tendermint/p2p"
ctypes "github.com/tendermint/tendermint/rpc/core/types"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/flags"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
)

// ValidatorInfo is info about the node's validator, same as Tendermint,
Expand Down
8 changes: 3 additions & 5 deletions app/cli/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,15 @@ import (
"path/filepath"
"strconv"

cfg "github.com/tendermint/tendermint/config"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/types/rest"

"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/client/input"
"github.com/cosmos/cosmos-sdk/client/rpc"
"github.com/cosmos/cosmos-sdk/server"
"github.com/cosmos/cosmos-sdk/types/rest"
"github.com/cosmos/go-bip39"
"github.com/spf13/cobra"
cfg "github.com/tendermint/tendermint/config"
"github.com/tendermint/tendermint/crypto/ed25519"
"github.com/tendermint/tendermint/crypto/secp256k1"
tmos "github.com/tendermint/tendermint/libs/os"
Expand Down
3 changes: 1 addition & 2 deletions app/export.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,12 @@ package app
import (
"encoding/json"

tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/cosmos/cosmos-sdk/x/staking"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
)

// ExportAppStateAndValidators exports the state of the application for a genesis
Expand Down
Loading

0 comments on commit 77055a6

Please sign in to comment.