Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: fix Makefile for format and execute make format #230

Merged
merged 15 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions .github/workflows/format.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: Check Make Format
# this workflow checks that go files is formated by `make format`
on:
pull_request:
push:
branches:
- main

jobs:
check-format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
with:
go-version: '1.20'
- name: Display go version
run: go version
- uses: actions/cache@v3
id: cache
with:
path: ~/go/bin
key: ${{ runner.os }}-go-v1.20-misspell-v0.3.4-goimports-reviser-v3.4.5
- name: install misspell
if: steps.cache.outputs.cache-hit != 'true'
run: |
go install github.com/client9/misspell/cmd/misspell@v0.3.4
- name: install goimports-reviser
if: steps.cache.outputs.cache-hit != 'true'
run: |
go install github.com/incu6us/goimports-reviser/v3@v3.4.5
- name: Make Format
run: make format
- name: Check Diff
run: git diff --exit-code
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ Ref: https://keepachangelog.com/en/1.0.0/
* (ibc) [\#246](https://github.com/Finschia/finschia/pull/246) Update ibc-go to v4

### Improvements
* (improvements) [\#230](https://github.com/Finschia/finschia/pull/230) fix Makefile for format and execute make format #230

* (build) [\#221](https://github.com/Finschia/finschia/pull/221) compile static binary as release assets and docker image
* (swagger) [\#223](https://github.com/Finschia/finschia/pull/223) add integrated swagger for finschia

Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -312,9 +312,9 @@ lint:
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" | xargs gofmt -d -s

format:
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/lcd/statik/statik.go" | xargs goimports -w -local github.com/Finschia/finschia-sdk
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" | xargs -n1 goimports-reviser -rm-unused -set-alias -project-name "github.com/Finschia/finschia/" -company-prefixes "github.com/Finschia/"

###############################################################################
### Localnet ###
Expand Down
5 changes: 3 additions & 2 deletions ante/ante.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
package ante

import (
ibcante "github.com/cosmos/ibc-go/v4/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"

sdk "github.com/Finschia/finschia-sdk/types"
sdkerrors "github.com/Finschia/finschia-sdk/types/errors"
"github.com/Finschia/finschia-sdk/x/auth/ante"
wasmkeeper "github.com/Finschia/wasmd/x/wasm/keeper"
wasmtypes "github.com/Finschia/wasmd/x/wasm/types"
ibcante "github.com/cosmos/ibc-go/v4/modules/core/ante"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
)

// HandlerOptions extend the SDK's AnteHandler options by requiring the IBC
Expand Down
5 changes: 3 additions & 2 deletions ante/ante_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import (
"fmt"
"testing"

"github.com/stretchr/testify/suite"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

"github.com/Finschia/finschia-sdk/client"
"github.com/Finschia/finschia-sdk/client/tx"
cryptotypes "github.com/Finschia/finschia-sdk/crypto/types"
Expand All @@ -13,8 +16,6 @@ import (
"github.com/Finschia/finschia-sdk/types/tx/signing"
xauthsigning "github.com/Finschia/finschia-sdk/x/auth/signing"
ocrand "github.com/Finschia/ostracon/libs/rand"
"github.com/stretchr/testify/suite"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

linkapp "github.com/Finschia/finschia/app"
linkhelpers "github.com/Finschia/finschia/app/helpers"
Expand Down
41 changes: 19 additions & 22 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,23 @@ import (
"os"
"path/filepath"

ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts"
icahost "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types"
"github.com/cosmos/ibc-go/v4/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v4/modules/core"
ibcclient "github.com/cosmos/ibc-go/v4/modules/core/02-client"
ibcclientclient "github.com/cosmos/ibc-go/v4/modules/core/02-client/client"
ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"
"github.com/gorilla/mux"
"github.com/rakyll/statik/fs"

ocabci "github.com/Finschia/ostracon/abci/types"
"github.com/Finschia/ostracon/libs/log"
ostos "github.com/Finschia/ostracon/libs/os"
abci "github.com/tendermint/tendermint/abci/types"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"
Expand Down Expand Up @@ -101,33 +112,19 @@ import (
upgradeclient "github.com/Finschia/finschia-sdk/x/upgrade/client"
upgradekeeper "github.com/Finschia/finschia-sdk/x/upgrade/keeper"
upgradetypes "github.com/Finschia/finschia-sdk/x/upgrade/types"
ocabci "github.com/Finschia/ostracon/abci/types"
"github.com/Finschia/ostracon/libs/log"
ostos "github.com/Finschia/ostracon/libs/os"
"github.com/Finschia/wasmd/x/wasm"
wasmclient "github.com/Finschia/wasmd/x/wasm/client"
wasmkeeper "github.com/Finschia/wasmd/x/wasm/keeper"
"github.com/Finschia/wasmd/x/wasmplus"
wasmpluskeeper "github.com/Finschia/wasmd/x/wasmplus/keeper"
wasmplustypes "github.com/Finschia/wasmd/x/wasmplus/types"
ica "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts"
icahost "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host"
icahostkeeper "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/keeper"
icahosttypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/host/types"
icatypes "github.com/cosmos/ibc-go/v4/modules/apps/27-interchain-accounts/types"
"github.com/cosmos/ibc-go/v4/modules/apps/transfer"
ibctransferkeeper "github.com/cosmos/ibc-go/v4/modules/apps/transfer/keeper"
ibctransfertypes "github.com/cosmos/ibc-go/v4/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v4/modules/core"
ibcclient "github.com/cosmos/ibc-go/v4/modules/core/02-client"
ibcclientclient "github.com/cosmos/ibc-go/v4/modules/core/02-client/client"
ibcclienttypes "github.com/cosmos/ibc-go/v4/modules/core/02-client/types"
porttypes "github.com/cosmos/ibc-go/v4/modules/core/05-port/types"
ibchost "github.com/cosmos/ibc-go/v4/modules/core/24-host"
ibckeeper "github.com/cosmos/ibc-go/v4/modules/core/keeper"

appante "github.com/Finschia/finschia/ante"
appparams "github.com/Finschia/finschia/app/params"

// unnamed import of statik for swagger UI support
_ "github.com/Finschia/finschia/client/docs/statik"
_ "github.com/Finschia/finschia/client/docs/statik" // unnamed import of statik for swagger UI support
loloicci marked this conversation as resolved.
Show resolved Hide resolved
)

const appName = "Finschia"
Expand Down
10 changes: 4 additions & 6 deletions app/app_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"os"
"testing"

"github.com/cosmos/ibc-go/v4/modules/apps/transfer"
ibc "github.com/cosmos/ibc-go/v4/modules/core"
"github.com/golang/mock/gomock"
"github.com/stretchr/testify/require"

"github.com/Finschia/ostracon/libs/log"
abci "github.com/tendermint/tendermint/abci/types"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"
Expand All @@ -32,16 +32,14 @@ import (
foundationmodule "github.com/Finschia/finschia-sdk/x/foundation/module"
"github.com/Finschia/finschia-sdk/x/genutil"
"github.com/Finschia/finschia-sdk/x/gov"
"github.com/Finschia/wasmd/x/wasmplus"

"github.com/Finschia/finschia-sdk/x/mint"
"github.com/Finschia/finschia-sdk/x/params"
"github.com/Finschia/finschia-sdk/x/slashing"
"github.com/Finschia/finschia-sdk/x/staking"
tokenmodule "github.com/Finschia/finschia-sdk/x/token/module"
"github.com/Finschia/finschia-sdk/x/upgrade"
"github.com/cosmos/ibc-go/v4/modules/apps/transfer"
ibc "github.com/cosmos/ibc-go/v4/modules/core"
"github.com/Finschia/ostracon/libs/log"
"github.com/Finschia/wasmd/x/wasmplus"
)

func TestSimAppExportAndBlockedAddrs(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion app/genesis_account_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"testing"
"time"

"github.com/Finschia/ostracon/crypto"
"github.com/stretchr/testify/require"

"github.com/Finschia/finschia-sdk/crypto/keys/secp256k1"
"github.com/Finschia/finschia-sdk/simapp"
sdk "github.com/Finschia/finschia-sdk/types"
authtypes "github.com/Finschia/finschia-sdk/x/auth/types"
"github.com/Finschia/ostracon/crypto"
)

func TestSimGenesisAccountValidate(t *testing.T) {
Expand Down
5 changes: 3 additions & 2 deletions app/helpers/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,14 @@ import (
"testing"
"time"

"github.com/Finschia/ostracon/libs/log"
octypes "github.com/Finschia/ostracon/types"
"github.com/stretchr/testify/require"
abci "github.com/tendermint/tendermint/abci/types"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"

"github.com/Finschia/ostracon/libs/log"
octypes "github.com/Finschia/ostracon/types"

linkapp "github.com/Finschia/finschia/app"
)

Expand Down
3 changes: 2 additions & 1 deletion cli_test/cli_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,15 @@ import (
"testing"
"time"

"github.com/stretchr/testify/require"

"github.com/Finschia/finschia-sdk/client/flags"
"github.com/Finschia/finschia-sdk/crypto/keys/ed25519"
sdk "github.com/Finschia/finschia-sdk/types"
"github.com/Finschia/finschia-sdk/types/tx"
gov "github.com/Finschia/finschia-sdk/x/gov/types"
minttypes "github.com/Finschia/finschia-sdk/x/mint/types"
osttypes "github.com/Finschia/ostracon/types"
"github.com/stretchr/testify/require"

"github.com/Finschia/finschia/app"
)
Expand Down
3 changes: 1 addition & 2 deletions cli_test/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,14 +52,13 @@ import (
stakingcli "github.com/Finschia/finschia-sdk/x/staking/client/cli"
staking "github.com/Finschia/finschia-sdk/x/staking/types"
"github.com/Finschia/finschia-sdk/x/stakingplus"
wasmcli "github.com/Finschia/wasmd/x/wasm/client/cli"

ostcmd "github.com/Finschia/ostracon/cmd/ostracon/commands"
ostcfg "github.com/Finschia/ostracon/config"
"github.com/Finschia/ostracon/libs/log"
osthttp "github.com/Finschia/ostracon/rpc/client/http"
ostctypes "github.com/Finschia/ostracon/rpc/core/types"
osttypes "github.com/Finschia/ostracon/types"
wasmcli "github.com/Finschia/wasmd/x/wasm/client/cli"
wasmtypes "github.com/Finschia/wasmd/x/wasm/types"

"github.com/Finschia/finschia/app"
Expand Down
10 changes: 4 additions & 6 deletions cmd/fnsad/cmd/genaccounts_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,24 @@ package cmd_test
import (
"context"
"fmt"

"testing"

"github.com/Finschia/finschia-sdk/crypto/hd"
"github.com/Finschia/finschia-sdk/crypto/keyring"
sdk "github.com/Finschia/finschia-sdk/types"

"github.com/Finschia/ostracon/libs/log"
"github.com/spf13/viper"
"github.com/stretchr/testify/require"

"github.com/Finschia/finschia-sdk/client"
"github.com/Finschia/finschia-sdk/client/flags"
"github.com/Finschia/finschia-sdk/crypto/hd"
"github.com/Finschia/finschia-sdk/crypto/keyring"
"github.com/Finschia/finschia-sdk/server"
"github.com/Finschia/finschia-sdk/simapp"
simcmd "github.com/Finschia/finschia-sdk/simapp/simd/cmd"
"github.com/Finschia/finschia-sdk/testutil/testdata"
sdk "github.com/Finschia/finschia-sdk/types"
"github.com/Finschia/finschia-sdk/types/module"
"github.com/Finschia/finschia-sdk/x/genutil"
genutiltest "github.com/Finschia/finschia-sdk/x/genutil/client/testutil"
"github.com/Finschia/ostracon/libs/log"
)

var testMbm = module.NewBasicManager(genutil.AppModuleBasic{})
Expand Down
11 changes: 6 additions & 5 deletions cmd/fnsad/cmd/root.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ import (
"os"
"path/filepath"

"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/cast"
"github.com/spf13/cobra"
"github.com/spf13/viper"
dbm "github.com/tendermint/tm-db"

"github.com/Finschia/finschia-sdk/baseapp"
"github.com/Finschia/finschia-sdk/client"
"github.com/Finschia/finschia-sdk/client/config"
Expand All @@ -31,11 +37,6 @@ import (
"github.com/Finschia/ostracon/libs/log"
"github.com/Finschia/wasmd/x/wasm"
wasmkeeper "github.com/Finschia/wasmd/x/wasm/keeper"
"github.com/prometheus/client_golang/prometheus"
"github.com/spf13/cast"
"github.com/spf13/cobra"
"github.com/spf13/viper"
dbm "github.com/tendermint/tm-db"

"github.com/Finschia/finschia/app"
"github.com/Finschia/finschia/app/params"
Expand Down
5 changes: 3 additions & 2 deletions cmd/fnsad/cmd/root_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,13 @@ import (
"os"
"testing"

"github.com/stretchr/testify/require"
dbm "github.com/tendermint/tm-db"

"github.com/Finschia/finschia-sdk/client/flags"
"github.com/Finschia/finschia-sdk/server"
"github.com/Finschia/finschia-sdk/store/types"
"github.com/Finschia/ostracon/libs/log"
"github.com/stretchr/testify/require"
dbm "github.com/tendermint/tm-db"
)

func TestNewApp(t *testing.T) {
Expand Down
12 changes: 6 additions & 6 deletions cmd/fnsad/cmd/testnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@ import (
"os"
"path/filepath"

"github.com/Finschia/finschia-sdk/testutil"
ostconfig "github.com/Finschia/ostracon/config"
ostos "github.com/Finschia/ostracon/libs/os"
ostrand "github.com/Finschia/ostracon/libs/rand"
"github.com/Finschia/ostracon/types"
osttime "github.com/Finschia/ostracon/types/time"
"github.com/spf13/cobra"

"github.com/Finschia/finschia-sdk/client"
Expand All @@ -26,13 +20,19 @@ import (
cryptotypes "github.com/Finschia/finschia-sdk/crypto/types"
"github.com/Finschia/finschia-sdk/server"
srvconfig "github.com/Finschia/finschia-sdk/server/config"
"github.com/Finschia/finschia-sdk/testutil"
sdk "github.com/Finschia/finschia-sdk/types"
"github.com/Finschia/finschia-sdk/types/module"
authtypes "github.com/Finschia/finschia-sdk/x/auth/types"
banktypes "github.com/Finschia/finschia-sdk/x/bank/types"
"github.com/Finschia/finschia-sdk/x/genutil"
genutiltypes "github.com/Finschia/finschia-sdk/x/genutil/types"
stakingtypes "github.com/Finschia/finschia-sdk/x/staking/types"
ostconfig "github.com/Finschia/ostracon/config"
ostos "github.com/Finschia/ostracon/libs/os"
ostrand "github.com/Finschia/ostracon/libs/rand"
"github.com/Finschia/ostracon/types"
osttime "github.com/Finschia/ostracon/types/time"
)

var (
Expand Down
5 changes: 3 additions & 2 deletions cmd/fnsad/cmd/testnet_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,16 @@ import (
"fmt"
"testing"

"github.com/spf13/viper"
"github.com/stretchr/testify/require"

"github.com/Finschia/finschia-sdk/client"
"github.com/Finschia/finschia-sdk/client/flags"
"github.com/Finschia/finschia-sdk/server"
banktypes "github.com/Finschia/finschia-sdk/x/bank/types"
genutiltest "github.com/Finschia/finschia-sdk/x/genutil/client/testutil"
genutiltypes "github.com/Finschia/finschia-sdk/x/genutil/types"
"github.com/Finschia/ostracon/libs/log"
"github.com/spf13/viper"
"github.com/stretchr/testify/require"

"github.com/Finschia/finschia/app"
)
Expand Down
Loading