Skip to content

Commit

Permalink
feat: remove golang 21 features and change logos
Browse files Browse the repository at this point in the history
  • Loading branch information
emidev98 committed Nov 9, 2023
1 parent 442dd78 commit 844393f
Show file tree
Hide file tree
Showing 17 changed files with 65 additions and 44 deletions.
19 changes: 12 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -328,11 +328,16 @@ lint:

lint-fix:
golangci-lint run --fix --out-format=tab --issues-exit-code=0

.PHONY: lint lint-fix

format:
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -path "./tests/mocks/*" -not -name '*.pb.go' -not -path "./_build/*" | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -path "./tests/mocks/*" -not -name '*.pb.go' -not -path "./_build/*" | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "./client/docs/statik/statik.go" -not -path "./tests/mocks/*" -not -name '*.pb.go' -not -path "./_build/*" | xargs goimports -w -local github.com/cosmos/cosmos-sdk
.PHONY: format
format-tools:
go install mvdan.cc/gofumpt@latest
go install github.com/client9/misspell/cmd/misspell@latest
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest

format: format-tools
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*statik*" -not -name '*.pb.go' | xargs gofmt -w -s
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*statik*" -not -name '*.pb.go' | xargs misspell -w
find . -name '*.go' -type f -not -path "./vendor*" -not -path "*.git*" -not -path "*statik*" -not -name '*.pb.go' | xargs goimports -w -local github.com/cosmos/cosmos-sdk

.PHONY: lint format-tools format
8 changes: 5 additions & 3 deletions app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ import (
"path/filepath"
"reflect" // #nosec G702

authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"
"github.com/prometheus/client_golang/prometheus"

authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation"

wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
"github.com/terra-money/core/v2/app/keepers"
"github.com/terra-money/core/v2/app/post"
Expand All @@ -28,6 +29,9 @@ import (
"github.com/cosmos/cosmos-sdk/client"
"github.com/cosmos/cosmos-sdk/codec/types"

custombankmodule "github.com/terra-money/core/v2/x/bank"
customwasmodule "github.com/terra-money/core/v2/x/wasm"

"github.com/cosmos/cosmos-sdk/baseapp"
nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node"
"github.com/cosmos/cosmos-sdk/client/grpc/tmservice"
Expand All @@ -52,8 +56,6 @@ import (
distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types"
"github.com/cosmos/cosmos-sdk/x/evidence"
feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module"
custombankmodule "github.com/terra-money/core/v2/x/bank"
customwasmodule "github.com/terra-money/core/v2/x/wasm"

"github.com/cosmos/cosmos-sdk/x/gov"
govclient "github.com/cosmos/cosmos-sdk/x/gov/client"
Expand Down
14 changes: 8 additions & 6 deletions app/keepers/keepers.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import (

"path/filepath"

"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router"
ibctransfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer"
ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client"
ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
"github.com/spf13/cast"

"github.com/cosmos/cosmos-sdk/baseapp"
"github.com/cosmos/cosmos-sdk/client/flags"
"github.com/cosmos/cosmos-sdk/codec"
Expand All @@ -28,11 +34,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/params"
paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal"
"github.com/cosmos/cosmos-sdk/x/upgrade"
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router"
ibctransfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer"
ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client"
ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
"github.com/spf13/cast"

"github.com/cosmos/cosmos-sdk/x/feegrant"
govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper"
Expand All @@ -58,7 +59,6 @@ import (
routerkeeper "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/keeper"
routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/types"

evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
icq "github.com/cosmos/ibc-apps/modules/async-icq/v7"
icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper"
Expand All @@ -71,6 +71,8 @@ import (
porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"

evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"

icqkeeper "github.com/cosmos/ibc-apps/modules/async-icq/v7/keeper"
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types"

Expand Down
16 changes: 9 additions & 7 deletions app/modules.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,6 @@ import (
"github.com/cosmos/cosmos-sdk/x/upgrade"

wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types"
vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
"github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router"
routertypes "github.com/cosmos/ibc-apps/middleware/packet-forward-middleware/v7/router/types"
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types"
Expand All @@ -60,6 +54,13 @@ import (
feesharetypes "github.com/terra-money/core/v2/x/feeshare/types"
tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types"

vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types"
capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types"
paramstypes "github.com/cosmos/cosmos-sdk/x/params/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

icq "github.com/cosmos/ibc-apps/modules/async-icq/v7"

solomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine"
Expand All @@ -79,9 +80,10 @@ import (
pob "github.com/skip-mev/pob/x/builder"
pobtype "github.com/skip-mev/pob/x/builder/types"

"github.com/cosmos/cosmos-sdk/x/feegrant"
ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported"
terrappsparams "github.com/terra-money/core/v2/app/params"

"github.com/cosmos/cosmos-sdk/x/feegrant"
)

// ModuleBasics defines the module BasicManager is in charge of setting up basic,
Expand Down
3 changes: 2 additions & 1 deletion app/post/post.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
package post

import (
sdk "github.com/cosmos/cosmos-sdk/types"
feesharepost "github.com/terra-money/core/v2/x/feeshare/post"
customwasmkeeper "github.com/terra-money/core/v2/x/wasm/keeper"
wasmpost "github.com/terra-money/core/v2/x/wasm/post"

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

type HandlerOptions struct {
Expand Down
9 changes: 5 additions & 4 deletions app/upgrade_handler.go
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
package app

import (
storetypes "github.com/cosmos/cosmos-sdk/store/types"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
ibchookstypes "github.com/cosmos/ibc-apps/modules/ibc-hooks/v7/types"
icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types"
ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types"
Expand All @@ -20,6 +16,11 @@ import (
feesharetypes "github.com/terra-money/core/v2/x/feeshare/types"
tokenfactorytypes "github.com/terra-money/core/v2/x/tokenfactory/types"

storetypes "github.com/cosmos/cosmos-sdk/store/types"
consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types"
crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"

icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types"
)

Expand Down
5 changes: 3 additions & 2 deletions app/upgrades/v2.7/upgrade.go
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package v2_7

import (
icqkeeper "github.com/cosmos/ibc-apps/modules/async-icq/v7/keeper"
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types"

"github.com/cosmos/cosmos-sdk/codec"
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/module"
upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types"
icqkeeper "github.com/cosmos/ibc-apps/modules/async-icq/v7/keeper"
icqtypes "github.com/cosmos/ibc-apps/modules/async-icq/v7/types"
)

func CreateUpgradeHandler(
Expand Down
File renamed without changes
1 change: 1 addition & 0 deletions docs/terra_logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p>&nbsp;</p>
<p align="center">
<a href="https://terra.money/"><img src="core_logo.svg" width=500>
<a href="https://terra.money/"><img src="docs/core_logo.svg" width=500>
</a>
</p>

Expand Down Expand Up @@ -98,7 +98,7 @@ If you are interested in contributing to the Terra Core source code, please revi

<p>&nbsp;</p>
<p align="center">
<a href="https://terra.money/"><img src="https://assets.website-files.com/611153e7af981472d8da199c/61794f2b6b1c7a1cb9444489_symbol-terra-blue.svg" align="center" width=200/></a>
<a href="https://terra.money/"><img src="docs/terra_logo.svg" align="center" width=200/></a>
<br />
<br />
© 2023 Terraform Labs, PTE LTD
Expand Down
1 change: 1 addition & 0 deletions x/bank/types/errors.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package types

import (
sdkerrors "cosmossdk.io/errors"

banktypes "github.com/cosmos/cosmos-sdk/x/bank/types"
)

Expand Down
9 changes: 5 additions & 4 deletions x/feeshare/post/post.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package ante

import (
"slices"

errorsmod "cosmossdk.io/errors"

sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -139,8 +137,11 @@ func CalculateFee(fees sdk.Coins, govPercent sdk.Dec, pairs int, allowedDenoms [
alloedFeesDenoms = fees
} else {
for _, fee := range fees {
if slices.Contains(allowedDenoms, fee.Denom) {
alloedFeesDenoms = alloedFeesDenoms.Add(fee)
for _, allowedDenom := range allowedDenoms {
if fee.Denom == allowedDenom {
alloedFeesDenoms = alloedFeesDenoms.Add(fee)
break
}
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion x/tokenfactory/bindings/wasm.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ package bindings
import (
"github.com/CosmWasm/wasmd/x/wasm"
wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper"
bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
tokenfactorykeeper "github.com/terra-money/core/v2/x/tokenfactory/keeper"

bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper"
)

func RegisterCustomPlugins(
Expand Down
3 changes: 2 additions & 1 deletion x/wasm/keeper/contracts.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
package keeper

import (
sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/terra-money/core/v2/x/wasm/types"

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

func (k Keeper) GetExecutedContractAddresses(ctx sdk.Context) (contracts types.ExecutedContracts, found bool) {
Expand Down
10 changes: 5 additions & 5 deletions x/wasm/keeper/keeper.go
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
package keeper

import (
"slices"

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

"github.com/cosmos/cosmos-sdk/codec"
storetypes "github.com/cosmos/cosmos-sdk/store/types"
sdk "github.com/cosmos/cosmos-sdk/types"
Expand Down Expand Up @@ -83,10 +82,11 @@ func (k Keeper) AfterExecuteContract(ctx sdk.Context, msg *types.MsgExecuteContr
}
// if the contract address has already been
// added just skip it to avoid duplicates
if slices.Contains(contractAddresses, attr.Value) {
continue
for _, item := range contractAddresses {
if item == attr.Value {
continue
}
}

contractAddresses = append(contractAddresses, attr.Value)
}
}
Expand Down
1 change: 1 addition & 0 deletions x/wasm/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (

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

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

Expand Down
3 changes: 2 additions & 1 deletion x/wasm/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,9 @@ import (
"github.com/CosmWasm/wasmd/x/wasm/simulation"
"github.com/CosmWasm/wasmd/x/wasm/types"

"github.com/cosmos/cosmos-sdk/types/module"
customwasmkeeper "github.com/terra-money/core/v2/x/wasm/keeper"

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

// AppModule implements an application module for the wasm module.
Expand Down

0 comments on commit 844393f

Please sign in to comment.