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

Enable gofumpt #1179

Merged
merged 9 commits into from
Apr 14, 2022
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
2 changes: 1 addition & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ linters:
# - godox <- detects TODO/BUG/FIXME and we may wantnthis later but isn't appropriate now
# - goerr113 <- disabled due to lack of comprehension
- gofmt
# - gofumpt
- gofumpt
- goheader
- goimports
# - gomoddirectives <- disables replaces
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -247,9 +247,10 @@ lint:
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run --timeout=10m

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/cosmos/cosmos-sdk
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name "*.pb.gw.go" -not -name "*.pb.go" | xargs gofumpt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name "*.pb.gw.go" -not -name "*.pb.go" | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -name "*.pb.gw.go" -not -name "*.pb.go" | xargs goimports -w -local github.com/cosmos/cosmos-sdk
@go run github.com/golangci/golangci-lint/cmd/golangci-lint run ./... --fix

###############################################################################
### Localnet ###
Expand Down
5 changes: 3 additions & 2 deletions app/ante.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@ package app
import (
wasm "github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
channelkeeper "github.com/cosmos/ibc-go/v2/modules/core/04-channel/keeper"
ibcante "github.com/cosmos/ibc-go/v2/modules/core/ante"

servertypes "github.com/cosmos/cosmos-sdk/server/types"
sdk "github.com/cosmos/cosmos-sdk/types"
ante "github.com/cosmos/cosmos-sdk/x/auth/ante"
"github.com/cosmos/cosmos-sdk/x/auth/signing"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
channelkeeper "github.com/cosmos/ibc-go/v2/modules/core/04-channel/keeper"
ibcante "github.com/cosmos/ibc-go/v2/modules/core/ante"

txfeeskeeper "github.com/osmosis-labs/osmosis/v7/x/txfees/keeper"
txfeestypes "github.com/osmosis-labs/osmosis/v7/x/txfees/types"
Expand Down
21 changes: 11 additions & 10 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,17 @@ import (
"strings"

"github.com/CosmWasm/wasmd/x/wasm"
transfer "github.com/cosmos/ibc-go/v2/modules/apps/transfer"
"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"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
Expand All @@ -30,16 +41,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/crisis"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
transfer "github.com/cosmos/ibc-go/v2/modules/apps/transfer"
"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"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
dbm "github.com/tendermint/tm-db"

appparams "github.com/osmosis-labs/osmosis/v7/app/params"
v4 "github.com/osmosis-labs/osmosis/v7/app/upgrades/v4"
Expand Down
5 changes: 3 additions & 2 deletions app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,14 @@ import (
"fmt"
"time"

"github.com/osmosis-labs/osmosis/v7/app/params"
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/crypto/hd"
"github.com/cosmos/cosmos-sdk/crypto/keyring"
"github.com/cosmos/cosmos-sdk/simapp"
"github.com/cosmos/cosmos-sdk/testutil/network"
"github.com/osmosis-labs/osmosis/v7/app/params"
dbm "github.com/tendermint/tm-db"

servertypes "github.com/cosmos/cosmos-sdk/server/types"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
Expand Down
3 changes: 2 additions & 1 deletion app/encoding.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package app

import (
"github.com/cosmos/cosmos-sdk/std"
"github.com/osmosis-labs/osmosis/v7/app/params"

"github.com/cosmos/cosmos-sdk/std"
)

// MakeEncodingConfig creates an EncodingConfig for testing.
Expand Down
17 changes: 9 additions & 8 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ package app
import (
"github.com/CosmWasm/wasmd/x/wasm"
wasmclient "github.com/CosmWasm/wasmd/x/wasm/client"
transfer "github.com/cosmos/ibc-go/v2/modules/apps/transfer"
ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v2/modules/core"
ibcclientclient "github.com/cosmos/ibc-go/v2/modules/core/02-client/client"
ibchost "github.com/cosmos/ibc-go/v2/modules/core/24-host"
"github.com/osmosis-labs/bech32-ibc/x/bech32ibc"
bech32ibctypes "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/types"
"github.com/osmosis-labs/bech32-ibc/x/bech32ics20"

"github.com/cosmos/cosmos-sdk/types/module"
"github.com/cosmos/cosmos-sdk/x/auth"
authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
Expand Down Expand Up @@ -36,14 +45,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/upgrade"
upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
transfer "github.com/cosmos/ibc-go/v2/modules/apps/transfer"
ibctransfertypes "github.com/cosmos/ibc-go/v2/modules/apps/transfer/types"
ibc "github.com/cosmos/ibc-go/v2/modules/core"
ibcclientclient "github.com/cosmos/ibc-go/v2/modules/core/02-client/client"
ibchost "github.com/cosmos/ibc-go/v2/modules/core/24-host"
"github.com/osmosis-labs/bech32-ibc/x/bech32ibc"
bech32ibctypes "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/types"
"github.com/osmosis-labs/bech32-ibc/x/bech32ics20"

appparams "github.com/osmosis-labs/osmosis/v7/app/params"
_ "github.com/osmosis-labs/osmosis/v7/client/docs/statik"
Expand Down
3 changes: 2 additions & 1 deletion app/params/config.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package params

import (
"github.com/osmosis-labs/osmosis/v7/v043_temp/address"

sdk "github.com/cosmos/cosmos-sdk/types"
sdkerrors "github.com/cosmos/cosmos-sdk/types/errors"
"github.com/osmosis-labs/osmosis/v7/v043_temp/address"
)

const (
Expand Down
5 changes: 3 additions & 2 deletions app/test_helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ import (
"encoding/json"
"os"

"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/libs/log"
dbm "github.com/tendermint/tm-db"

"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
)

// Setup initializes a new OsmosisApp.
Expand Down
13 changes: 6 additions & 7 deletions app/upgrades/v4/upgrade_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ import (
"testing"
"time"

sdk "github.com/cosmos/cosmos-sdk/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
"github.com/osmosis-labs/osmosis/v7/app"
v4 "github.com/osmosis-labs/osmosis/v7/app/upgrades/v4"
"github.com/stretchr/testify/suite"
abci "github.com/tendermint/tendermint/abci/types"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

sdk "github.com/cosmos/cosmos-sdk/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
)

type UpgradeTestSuite struct {
Expand Down Expand Up @@ -47,7 +48,7 @@ func (suite *UpgradeTestSuite) TestUpgradePayments() {
func() {
// mint coins to distribution module / feepool.communitypool

var bal = int64(1000000000000)
bal := int64(1000000000000)
coin := sdk.NewInt64Coin("uosmo", bal)
coins := sdk.NewCoins(coin)
err := suite.app.BankKeeper.MintCoins(suite.ctx, "mint", coins)
Expand All @@ -57,7 +58,6 @@ func (suite *UpgradeTestSuite) TestUpgradePayments() {
feePool := suite.app.DistrKeeper.GetFeePool(suite.ctx)
feePool.CommunityPool = feePool.CommunityPool.Add(sdk.NewDecCoinFromCoin(coin))
suite.app.DistrKeeper.SetFeePool(suite.ctx, feePool)

},
func() {
// run upgrade
Expand All @@ -75,7 +75,7 @@ func (suite *UpgradeTestSuite) TestUpgradePayments() {
})
},
func() {
var total = int64(0)
total := int64(0)

// check that each account got the payment expected
payments := v4.GetProp12Payments()
Expand All @@ -92,7 +92,7 @@ func (suite *UpgradeTestSuite) TestUpgradePayments() {
total += amount
}

//check that the total paid out was as expected
// check that the total paid out was as expected
suite.Require().Equal(total, int64(367926557424))

expectedBal := 1000000000000 - total
Expand Down Expand Up @@ -122,7 +122,6 @@ func (suite *UpgradeTestSuite) TestUpgradePayments() {
tc.pre_update()
tc.update()
tc.post_update()

})
}
}
7 changes: 4 additions & 3 deletions app/upgrades/v5/upgrades.go
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
package v5

import (
connectionkeeper "github.com/cosmos/ibc-go/v2/modules/core/03-connection/keeper"
ibcconnectiontypes "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types"
bech32ibctypes "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/types"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
"github.com/cosmos/cosmos-sdk/x/authz"
stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
connectionkeeper "github.com/cosmos/ibc-go/v2/modules/core/03-connection/keeper"
ibcconnectiontypes "github.com/cosmos/ibc-go/v2/modules/core/03-connection/types"
bech32ibctypes "github.com/osmosis-labs/bech32-ibc/x/bech32ibc/types"

gammkeeper "github.com/osmosis-labs/osmosis/v7/x/gamm/keeper"
"github.com/osmosis-labs/osmosis/v7/x/txfees"
Expand Down
1 change: 1 addition & 0 deletions app/upgrades/v7/upgrades.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package v7
import (
"github.com/CosmWasm/wasmd/x/wasm"
wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper"
Expand Down
3 changes: 2 additions & 1 deletion app/wasm/bindings/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@ package wasmbindings

import (
"encoding/json"
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"testing"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion app/wasm/test/custom_msg_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ func TestSwapMsg(t *testing.T) {
func prepareSwapState(t *testing.T, ctx sdk.Context, osmosis *app.OsmosisApp) BaseState {
actor := RandomAccountAddress()

var swapperFunds = sdk.NewCoins(
swapperFunds := sdk.NewCoins(
sdk.NewInt64Coin("uatom", 333000000),
sdk.NewInt64Coin("uosmo", 555000000+3*poolFee),
sdk.NewInt64Coin("uregen", 777000000),
Expand Down
5 changes: 3 additions & 2 deletions app/wasm/test/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import (

"github.com/stretchr/testify/require"

"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/crypto/ed25519"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

"github.com/cosmos/cosmos-sdk/simapp"
sdk "github.com/cosmos/cosmos-sdk/types"

"github.com/osmosis-labs/osmosis/v7/app"
)

Expand Down
7 changes: 3 additions & 4 deletions app/wasm/test/messages_test.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package wasm

import (
"math"
"testing"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/osmosis-labs/osmosis/v7/app/wasm"
wasmbindings "github.com/osmosis-labs/osmosis/v7/app/wasm/bindings"
"github.com/stretchr/testify/assert"
"math"
"testing"

"github.com/stretchr/testify/require"
)
Expand Down Expand Up @@ -334,7 +335,6 @@ func TestSwap(t *testing.T) {
assert.InEpsilonf(t, (*spec.expCost.Out).ToDec().MustFloat64(), (*gotAmount.Out).ToDec().MustFloat64(), epsilon, "exp %s but got %s", spec.expCost.Out.String(), gotAmount.Out.String())
})
}

}

func TestSwapMultiHop(t *testing.T) {
Expand Down Expand Up @@ -517,5 +517,4 @@ func TestSwapMultiHop(t *testing.T) {
assert.InEpsilonf(t, (*spec.expCost.Out).ToDec().MustFloat64(), (*gotAmount.Out).ToDec().MustFloat64(), epsilon, "exp %s but got %s", spec.expCost.Out.String(), gotAmount.Out.String())
})
}

}
1 change: 0 additions & 1 deletion app/wasm/test/queries_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -486,5 +486,4 @@ func TestEstimateSwap(t *testing.T) {
assert.InEpsilonf(t, (*spec.expCost.Out).ToDec().MustFloat64(), (*gotCost.Out).ToDec().MustFloat64(), epsilon, "exp %s but got %s", spec.expCost.Out.String(), gotCost.Out.String())
})
}

}
2 changes: 1 addition & 1 deletion app/wasm/test/store_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (

"github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/CosmWasm/wasmd/x/wasm/types"

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

"github.com/osmosis-labs/osmosis/v7/app"
Expand Down Expand Up @@ -50,7 +51,6 @@ func storeCodeViaProposal(t *testing.T, ctx sdk.Context, osmosis *app.OsmosisApp
handler := govKeeper.Router().GetRoute(storedProposal.ProposalRoute())
err = handler(ctx, storedProposal.GetContent())
require.NoError(t, err)

}

func TestStoreCodeProposal(t *testing.T) {
Expand Down
13 changes: 7 additions & 6 deletions cmd/osmosisd/cmd/balances_from_state_export.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,6 @@ import (
"io/ioutil"
"os"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
appparams "github.com/osmosis-labs/osmosis/v7/app/params"
"github.com/osmosis-labs/osmosis/v7/osmoutils"
claimtypes "github.com/osmosis-labs/osmosis/v7/x/claim/types"
Expand All @@ -20,6 +14,13 @@ import (
"github.com/spf13/cobra"
tmjson "github.com/tendermint/tendermint/libs/json"
tmtypes "github.com/tendermint/tendermint/types"

"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/server"
sdk "github.com/cosmos/cosmos-sdk/types"
authtypes "github.com/cosmos/cosmos-sdk/x/auth/types"
banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types"
)

const FlagSelectPoolIds = "breakdown-by-pool-ids"
Expand Down
3 changes: 2 additions & 1 deletion cmd/osmosisd/cmd/genwasm.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package cmd

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

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

wasmcli "github.com/CosmWasm/wasmd/x/wasm/client/cli"
)

Expand Down
Loading