Skip to content

Commit

Permalink
Bump go to 1.20 and linter to v1.52.2 (#1550)
Browse files Browse the repository at this point in the history
* Update go version in docs and add a changelog entry.

* Bump the go version in all the github workflows.

* changelog tweak.

* Update all the docker images to use 1.20-bullseye (from 1.18-bullseye).

* Update go.mod to indicate go 1.20.

* Add rust-rc1 and rust upgrade handlers (empty), and remove the paua and paua-rc2 upgrades.

* Remove the deadcode and varcheck linters since they're giving a warning now: The owner seems to have abandoned the linter.  Replaced by unused.

* Bump golangci-lint to v1.52 for the lint github action.

* Fix things the linter started complaining about when I bumped it.

* Remove the docs/upgrade-1-8-summary.md document since it's no longer applicable.

* Create some devtool make targets for installing/updating golangci-lint.

* Add changelog entry about the linter.

* Put quotes around the 1.20 in all the github workflows since it's getting read as just 1.2.

* Put app/upgrades.go back to what it was since I'm doing the upgrade work in a different PR.
  • Loading branch information
SpicyLemon authored May 19, 2023
1 parent 602285f commit 049f0d5
Show file tree
Hide file tree
Showing 66 changed files with 155 additions and 308 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: '1.20'
- name: Go mod vendor
run: |
go mod vendor
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ jobs:
- uses: actions/setup-go@v4
if: env.GIT_DIFF
with:
go-version: 1.18
go-version: '1.20'
- uses: golangci/[email protected]
if: env.GIT_DIFF
with:
# Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version.
version: v1.48
# If you change this version, be sure to also change it in contrib/devtools/Makefile.
version: v1.52.2
args: --timeout 10m --out-${NO_FUTURE}format colored-line-number
github-token: ${{ secrets.github_token }}
- name: No Now Usage
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/proto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:
- name: Setup go
uses: actions/setup-go@v4
with:
go-version: 1.18
go-version: '1.20'
- name: Setup Job
id: setup
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ jobs:
version: ${{ steps.vars.outputs.version }}
is_release: ${{ steps.vars.outputs.is_release }}
prerelease: ${{ steps.vars.outputs.prerelease }}
go_version: 1.18
go_version: '1.20'

build_osx:
runs-on: macos-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rosetta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/setup-go@v4
if: ${{ env.GIT_DIFF }}
with:
go-version: 1.18
go-version: '1.20'
- name: Go mod vendor
if: ${{ env.GIT_DIFF }}
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sims.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jobs:
echo "Setting output: go-cache-key-hash=$go_cache_key_hash"
echo "go-cache-key-hash=$go_cache_key_hash" >> "$GITHUB_OUTPUT"
outputs:
go-version: 1.18
go-version: '1.20'
should-run: ${{ env.GIT_DIFF }}
file-prefix: ${{ steps.def-vars.outputs.file-prefix }}
db-cache-key-suffix: sims-db3-${{ steps.def-vars.outputs.db-cache-key-hash }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ jobs:
path: ./pkgs.txt.part.03
outputs:
should-run: ${{ env.GIT_DIFF }}
go-version: 1.18
go-version: '1.20'
file-prefix: ${{ steps.def-vars.outputs.file-prefix }}


Expand Down
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ Ref: https://keepachangelog.com/en/1.0.0/

### Improvements

* Bump go to `1.20` (from `1.18`) [#1539](https://github.com/provenance-io/provenance/issues/1539).
* Bump golangci-lint to `v1.52.2` (from `v1.48`) [#1539](https://github.com/provenance-io/provenance/issues/1539).
* New `make golangci-lint` target created for installing golangci-lint.
* New `make golangci-lint-update` target created for installing the current version even if you already have a version installed.
* Add marker deposit access check for sends to marker escrow account [#1525](https://github.com/provenance-io/provenance/issues/1525).
* Add support for `name` owner to execute `MsgModifyName` transaction [#1536](https://github.com/provenance-io/provenance/issues/1536).
* Add usage of `AddGovPropFlagsToCmd` and `ReadGovPropFlags` cli for `GetModifyNameCmd` [#1542](https://github.com/provenance-io/provenance/issues/1542).
Expand All @@ -53,7 +57,7 @@ Ref: https://keepachangelog.com/en/1.0.0/

### API Breaking

* Add marker deposit access check for sends to marker escrow account. Will break any current address that is sending to the
* Add marker deposit access check for sends to marker escrow account. Will break any current address that is sending to the
marker escrow account if it does not have deposit access. In order for it to work, deposit access needs to be added. This can be done using the `MsgAddAccessRequest` tx [#1525](https://github.com/provenance-io/provenance/issues/1525).
* `MsgMultiSend` is now limited to a single `Input` [PR 1506](https://github.com/provenance-io/provenance/pull/1506).

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ is a useful starting point.

Developers can use a local checkout and the make targets `make run` and `make localnet-start` to run a local development network.

Note: Requires [Go 1.18+](https://golang.org/dl/)
Note: Requires [Go 1.20+](https://golang.org/dl/)

See Also: [Building](docs/Building.md)

Expand Down
2 changes: 1 addition & 1 deletion app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ func (app *App) RegisterStreamingServices(appOpts servertypes.AppOptions) {
}

// RegisterSwaggerAPI registers swagger route with API Server
func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router) {
func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router) {
statikFS, err := fs.New()
if err != nil {
panic(err)
Expand Down
2 changes: 1 addition & 1 deletion client/rosetta/rosetta-ci/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18-bullseye as build
FROM golang:1.20-bullseye as build
ARG VERSION

WORKDIR /go/src/github.com/provenance-io/provenance
Expand Down
5 changes: 1 addition & 4 deletions cmd/dbmigrate/cmd/dbmigrate.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,8 @@ Migration process:
if err := client.SetCmdClientContext(command, clientCtx); err != nil {
return err
}
if err := config.InterceptConfigsPreRunHandler(command); err != nil {
return err
}

return nil
return config.InterceptConfigsPreRunHandler(command)
},
RunE: func(command *cobra.Command, args []string) error {
batchSizeMB, err := command.Flags().GetUint(FlagBatchSize)
Expand Down
5 changes: 1 addition & 4 deletions cmd/dbmigrate/utils/migrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,10 +162,7 @@ func (m *Migrator) Initialize() error {
if err = m.ValidateBasic(); err != nil {
return err
}
if err = m.ReadSourceDataDir(); err != nil {
return err
}
return nil
return m.ReadSourceDataDir()
}

// ApplyDefaults fills in the defaults that it can, for values that aren't set yet.
Expand Down
6 changes: 1 addition & 5 deletions cmd/provenanced/config/interceptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,7 @@ func InterceptConfigsPreRunHandler(cmd *cobra.Command) error {
}

// Read the configs into viper and the contexts.
if err := LoadConfigFromFiles(cmd); err != nil {
return err
}

return nil
return LoadConfigFromFiles(cmd)
}

// Binds viper flags using the PIO ENV prefix.
Expand Down
11 changes: 10 additions & 1 deletion contrib/devtools/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -89,4 +89,13 @@ tools-clean:
rm -f $(STATIK) $(GOLANGCI_LINT) $(RUNSIM)
rm -f proto-tools-stamp tools-stamp

.PHONY: tools-clean statik runsim
# If you change this version, be sure to also change it in .github/workflows/lint.yml.
GOLANGCI_LINT_VERSION = v1.52.2
golangci-lint: $(GOLANGCI_LINT)
$(GOLANGCI_LINT):
@$(MAKE) golangci-lint-update
golangci-lint-update:
@echo "Installing golangci-lint $(GOLANGCI_LINT_VERSION) ..."
curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TOOLS_DESTDIR) $(GOLANGCI_LINT_VERSION)

.PHONY: tools-clean statik runsim golangci-lint golangci-lint-update
2 changes: 1 addition & 1 deletion docker/blockchain/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.18-bullseye as build
FROM golang:1.20-bullseye as build
ARG VERSION
ARG ARCH=x86_64

Expand Down
2 changes: 1 addition & 1 deletion docs/Building.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Built executables are placed in the `build/` directory.

### Go

Building `provenanced` requires [Go 1.18+](https://golang.org/dl/) (or higher).
Building `provenanced` requires [Go 1.20+](https://golang.org/dl/) (or higher).

### CLevelDB

Expand Down
68 changes: 0 additions & 68 deletions docs/upgrade-1-8-summary.md

This file was deleted.

2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/provenance-io/provenance

go 1.18
go 1.20

require (
cosmossdk.io/errors v1.0.0-beta.7
Expand Down
2 changes: 1 addition & 1 deletion internal/handlers/msg_fee_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func NewMsgFeeInvoker(bankKeeper bankkeeper.Keeper, accountKeeper msgfeestypes.A
}
}

func (afd MsgFeeInvoker) Invoke(ctx sdk.Context, simulate bool) (sdk.Coins, sdk.Events, error) {
func (afd MsgFeeInvoker) Invoke(ctx sdk.Context, _ bool) (sdk.Coins, sdk.Events, error) {
chargedFees := sdk.Coins{}
eventsToReturn := sdk.Events{}

Expand Down
9 changes: 4 additions & 5 deletions internal/handlers/staking_restrictions_hooks.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ func NewStakingRestrictionHooks(k *stakingkeeper.Keeper, opts RestrictionOptions
}

// Verifies that the delegation would not cause the validator's voting power to exceed our staking distribution limits
func (h StakingRestrictionHooks) AfterDelegationModified(ctx sdktypes.Context, delAddr sdktypes.AccAddress, valAddr sdktypes.ValAddress) error {
func (h StakingRestrictionHooks) AfterDelegationModified(ctx sdktypes.Context, _ sdktypes.AccAddress, valAddr sdktypes.ValAddress) error {
valCount := len(h.k.GetLastValidators(ctx))

// do not bother with limits on networks this small (or under simulation).
Expand All @@ -82,8 +82,7 @@ func (h StakingRestrictionHooks) AfterDelegationModified(ctx sdktypes.Context, d

// if the power of this validator is increasing and it is over the maximum bonded token amount then we error out this transaction.
if power > oldPower && validator.GetBondedTokens().GT(maxBond) {
return sdkerrors.Wrapf(
sdkerrors.ErrInvalidRequest,
return sdkerrors.ErrInvalidRequest.Wrapf(
"validator bonded tokens of %d exceeds max of %d (%.1f%%) for %d validators",
currentBond.BigInt(),
maxBond.BigInt(),
Expand All @@ -97,7 +96,7 @@ func (h StakingRestrictionHooks) AfterDelegationModified(ctx sdktypes.Context, d
}

// Implements sdktypes.ValidatorHooks
func (h StakingRestrictionHooks) BeforeDelegationCreated(ctx sdktypes.Context, _ sdktypes.AccAddress, _ sdktypes.ValAddress) error {
func (h StakingRestrictionHooks) BeforeDelegationCreated(_ sdktypes.Context, _ sdktypes.AccAddress, _ sdktypes.ValAddress) error {
return nil
}

Expand All @@ -112,7 +111,7 @@ func (h StakingRestrictionHooks) AfterValidatorRemoved(_ sdktypes.Context, _ sdk
}

// Implements sdktypes.ValidatorHooks
func (h StakingRestrictionHooks) AfterValidatorCreated(_ sdktypes.Context, valAddr sdktypes.ValAddress) error {
func (h StakingRestrictionHooks) AfterValidatorCreated(_ sdktypes.Context, _ sdktypes.ValAddress) error {
return nil
}

Expand Down
6 changes: 3 additions & 3 deletions internal/provwasm/simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (pw Wrapper) ProposalContents(simState module.SimulationState) []simtypes.W
}

// RandomizedParams returns empty list as the params don't change
func (pw Wrapper) RandomizedParams(r *rand.Rand) []simtypes.ParamChange {
func (pw Wrapper) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange {
return []simtypes.ParamChange{}
}

Expand All @@ -96,7 +96,7 @@ func (pw Wrapper) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) {
}

// WeightedOperations returns the all the provwasm operations with their respective weights.
func (pw Wrapper) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation {
func (pw Wrapper) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation {
count := 0
return []simtypes.WeightedOperation{
simulation.NewWeightedOperation(
Expand Down Expand Up @@ -338,7 +338,7 @@ func SimulateMsgInstantiateContract(ak authkeeper.AccountKeeperI, bk bankkeeper.
}
}

func SimulateMsgExecuteContract(ak authkeeper.AccountKeeperI, bk bankkeeper.ViewKeeper, node, consumer simtypes.Account, contractAddr string) simtypes.Operation {
func SimulateMsgExecuteContract(ak authkeeper.AccountKeeperI, bk bankkeeper.ViewKeeper, _, consumer simtypes.Account, contractAddr string) simtypes.Operation {
return func(
r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string,
) (simtypes.OperationMsg, []simtypes.FutureOperation, error) {
Expand Down
4 changes: 2 additions & 2 deletions networks/dev/blockchain-dev/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Use `make docker-build-dev` to build or `make devnet-start` to
# start the test network and `make devnet-stop` to stop it.

FROM golang:1.18-bullseye as build-x86_64
FROM golang:1.20-bullseye as build-x86_64
WORKDIR /go/src/github.com/provenance-io/provenance
ENV GOPRIVATE=github.com/provenance-io
RUN apt-get update && apt-get upgrade -y
Expand Down Expand Up @@ -48,7 +48,7 @@ CMD ["start"]


## Build provenance for ARM
FROM golang:1.18-bullseye as build-arm64
FROM golang:1.20-bullseye as build-arm64
WORKDIR /go/src/github.com/provenance-io/provenance
ENV GOPRIVATE=github.com/provenance-io
RUN apt-get update && apt-get upgrade -y
Expand Down
4 changes: 2 additions & 2 deletions networks/ibc/blockchain-ibc/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# start the test network and `make localnet-stop` to stop it.

## Build provenance for x86_64
FROM golang:1.18-bullseye as build-x86_64
FROM golang:1.20-bullseye as build-x86_64
WORKDIR /go/src/github.com/provenance-io/provenance
ENV GOPRIVATE=github.com/provenance-io
RUN apt-get update && apt-get upgrade -y
Expand Down Expand Up @@ -52,7 +52,7 @@ CMD ["start"]


## Build provenance for ARM
FROM golang:1.18-bullseye as build-arm64
FROM golang:1.20-bullseye as build-arm64
WORKDIR /go/src/github.com/provenance-io/provenance
ENV GOPRIVATE=github.com/provenance-io
RUN apt-get update && apt-get upgrade -y
Expand Down
2 changes: 1 addition & 1 deletion networks/ibc/blockchain-relayer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## Build provenance for ARM
FROM golang:1.18-bullseye as build
FROM golang:1.20-bullseye as build
WORKDIR /
ARG VERSION
RUN apt-get update && apt-get upgrade -y && apt-get install -y git
Expand Down
4 changes: 2 additions & 2 deletions networks/local/blockchain-local/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# start the test network and `make localnet-stop` to stop it.

## Build provenance for x86_64
FROM golang:1.18-bullseye as build-x86_64
FROM golang:1.20-bullseye as build-x86_64
WORKDIR /go/src/github.com/provenance-io/provenance
ENV GOPRIVATE=github.com/provenance-io
RUN apt-get update && apt-get upgrade -y
Expand Down Expand Up @@ -52,7 +52,7 @@ CMD ["start"]


## Build provenance for ARM
FROM golang:1.18-bullseye as build-arm64
FROM golang:1.20-bullseye as build-arm64
WORKDIR /go/src/github.com/provenance-io/provenance
ENV GOPRIVATE=github.com/provenance-io
RUN apt-get update && apt-get upgrade -y
Expand Down
Loading

0 comments on commit 049f0d5

Please sign in to comment.