From 0b98065478a4011cc3393a8452183350077df7d8 Mon Sep 17 00:00:00 2001 From: Ryan Christoffersen <12519942+ryanchristo@users.noreply.github.com> Date: Thu, 15 Dec 2022 18:22:23 -0800 Subject: [PATCH] build: update go version to 1.19 (#1689) (cherry picked from commit 3f7a60183faaaf062747d1322a5430ab18b55295) --- CHANGELOG.md | 1 + Makefile | 2 +- README.md | 2 +- api/go.mod | 2 +- app/client/cli/cmd_test.go | 8 +++----- app/utils.go | 4 ++-- docs/ledger/get-started/README.md | 2 +- docs/validators/get-started/README.md | 8 ++++---- docs/validators/upgrades/v5.0-upgrade.md | 2 +- go.mod | 2 +- images/regen-env/Dockerfile | 2 +- images/regen-sandbox/Dockerfile | 2 +- types/go.mod | 2 +- types/testutil/network/util.go | 4 ++-- x/data/client/tx.go | 4 ++-- x/data/client/util.go | 4 ++-- x/data/go.mod | 2 +- x/ecocredit/base/client/utils.go | 8 ++++---- x/ecocredit/basket/client/util.go | 4 ++-- x/ecocredit/go.mod | 2 +- x/ecocredit/marketplace/client/util.go | 8 ++++---- x/intertx/go.mod | 2 +- 22 files changed, 38 insertions(+), 39 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 832b0ce49f..9fc109bc60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - [#1244](https://github.com/regen-network/regen-ledger/pull/1244) Update all modules to Cosmos SDK v0.46 - [#1479](https://github.com/regen-network/regen-ledger/pull/1479) Update ORM tables from v1alpha1 to v1 - [#1579](https://github.com/regen-network/regen-ledger/pull/1579) Update all modules to use `errors` module +- [#1689](https://github.com/regen-network/regen-ledger/pull/1689) Update all modules to Go `1.19` ### app diff --git a/Makefile b/Makefile index 7c08020c94..fdef52aafd 100644 --- a/Makefile +++ b/Makefile @@ -151,7 +151,7 @@ install: go.sum go-version GO_MAJOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f1) GO_MINOR_VERSION = $(shell go version | cut -c 14- | cut -d' ' -f1 | cut -d'.' -f2) MIN_GO_MAJOR_VERSION = 1 -MIN_GO_MINOR_VERSION = 18 +MIN_GO_MINOR_VERSION = 19 GO_VERSION_ERROR = Golang version $(GO_MAJOR_VERSION).$(GO_MINOR_VERSION) is not supported, \ please update to at least $(MIN_GO_MAJOR_VERSION).$(MIN_GO_MINOR_VERSION) diff --git a/README.md b/README.md index 5433b1e2fe..ddf2a9189c 100644 --- a/README.md +++ b/README.md @@ -83,7 +83,7 @@ Contributions are more than welcome and greatly appreciated. All the information - [Git](https://git-scm.com) `>=2` - [Make](https://www.gnu.org/software/make/) `>=4` -- [Go](https://golang.org/) `>=1.18` +- [Go](https://golang.org/) `>=1.19` ### Go Tools diff --git a/api/go.mod b/api/go.mod index 8266025c25..c53e595d89 100644 --- a/api/go.mod +++ b/api/go.mod @@ -1,6 +1,6 @@ module github.com/regen-network/regen-ledger/api/v2 -go 1.18 +go 1.19 require ( github.com/cosmos/cosmos-proto v1.0.0-beta.1 diff --git a/app/client/cli/cmd_test.go b/app/client/cli/cmd_test.go index 29fe5ef037..2f374bbf44 100644 --- a/app/client/cli/cmd_test.go +++ b/app/client/cli/cmd_test.go @@ -2,7 +2,7 @@ package cli_test import ( "fmt" - "io/ioutil" + "os" "testing" "github.com/stretchr/testify/require" @@ -15,9 +15,7 @@ import ( ) func TestInitCmd(t *testing.T) { - nodeHome, err := ioutil.TempDir(t.TempDir(), ".regen") - require.NoError(t, err) - + nodeHome := os.TempDir() rootCmd, _ := cli.NewRootCmd() rootCmd.SetArgs([]string{ "init", // Test the init cmd @@ -25,6 +23,6 @@ func TestInitCmd(t *testing.T) { fmt.Sprintf("--%s=%s", flags.FlagHome, nodeHome), // Set home flag }) - err = cmd.Execute(rootCmd, app.EnvPrefix, app.DefaultNodeHome) + err := cmd.Execute(rootCmd, app.EnvPrefix, app.DefaultNodeHome) require.NoError(t, err) } diff --git a/app/utils.go b/app/utils.go index 1f2a1f9f9c..b76397e4c6 100644 --- a/app/utils.go +++ b/app/utils.go @@ -2,7 +2,7 @@ package app import ( "encoding/json" - "io/ioutil" + "os" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/types/module" @@ -18,7 +18,7 @@ func SimulationOperations(app *RegenApp, cdc codec.Codec, config simulation.Conf } if config.ParamsFile != "" { - bz, err := ioutil.ReadFile(config.ParamsFile) + bz, err := os.ReadFile(config.ParamsFile) if err != nil { panic(err) } diff --git a/docs/ledger/get-started/README.md b/docs/ledger/get-started/README.md index fb6e1d579a..51ce52a2bc 100644 --- a/docs/ledger/get-started/README.md +++ b/docs/ledger/get-started/README.md @@ -114,7 +114,7 @@ In order to build the `regen` binary from source, you'll need the following: - [Git](https://git-scm.com) `>=2` . - [Make](https://www.gnu.org/software/make/) `>=4` -- [Go](https://golang.org/) `>=1.18` +- [Go](https://golang.org/) `>=1.19` ### Go Environment diff --git a/docs/validators/get-started/README.md b/docs/validators/get-started/README.md index 4b07d4bba9..1874b0da76 100644 --- a/docs/validators/get-started/README.md +++ b/docs/validators/get-started/README.md @@ -31,25 +31,25 @@ sudo apt install git build-essential wget jq -y Download Go: ```bash -wget https://dl.google.com/go/go1.18.4.linux-amd64.tar.gz +wget https://dl.google.com/go/go1.19.4.linux-amd64.tar.gz ``` Verify data integrity: ```bash -sha256sum go1.18.4.linux-amd64.tar.gz +sha256sum go1.19.4.linux-amd64.tar.gz ``` Verify SHA-256 hash: ```bash -c9b099b68d93f5c5c8a8844a89f8db07eaa58270e3a1e01804f17f4cf8df02f5 +9df122d6baf6f2275270306b92af3b09d7973fb1259257e284dba33c0db14f1b ``` Unpack Go download: ```bash -sudo tar -C /usr/local -xzf go1.18.4.linux-amd64.tar.gz +sudo tar -C /usr/local -xzf go1.19.4.linux-amd64.tar.gz ``` Set up environment: diff --git a/docs/validators/upgrades/v5.0-upgrade.md b/docs/validators/upgrades/v5.0-upgrade.md index 47ec1e60f3..60766bd556 100644 --- a/docs/validators/upgrades/v5.0-upgrade.md +++ b/docs/validators/upgrades/v5.0-upgrade.md @@ -29,7 +29,7 @@ gasFee="0.0025regen" \ ### Update Go -**Go `1.18` or later is required.** +**Go `1.19` or later is required.** For available downloads, see [Go Downloads](https://go.dev/dl/). diff --git a/go.mod b/go.mod index 3c32c6cc94..11e7879b00 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/regen-network/regen-ledger/v5 -go 1.18 +go 1.19 require ( cosmossdk.io/math v1.0.0-beta.4 diff --git a/images/regen-env/Dockerfile b/images/regen-env/Dockerfile index a8a6f5541f..6d4310b61a 100644 --- a/images/regen-env/Dockerfile +++ b/images/regen-env/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.18-alpine AS build +FROM golang:1.19-alpine AS build RUN apk add build-base git linux-headers WORKDIR /work diff --git a/images/regen-sandbox/Dockerfile b/images/regen-sandbox/Dockerfile index 2fe472b3a1..0b86d6bdda 100644 --- a/images/regen-sandbox/Dockerfile +++ b/images/regen-sandbox/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.18-alpine AS build +FROM golang:1.19-alpine AS build RUN apk -U upgrade RUN apk add build-base git linux-headers diff --git a/types/go.mod b/types/go.mod index 4cbf59d2b7..db063dc08c 100644 --- a/types/go.mod +++ b/types/go.mod @@ -1,6 +1,6 @@ module github.com/regen-network/regen-ledger/types/v2 -go 1.18 +go 1.19 require ( cosmossdk.io/errors v1.0.0-beta.7 diff --git a/types/testutil/network/util.go b/types/testutil/network/util.go index 6cce1640a8..2a97f73d2f 100644 --- a/types/testutil/network/util.go +++ b/types/testutil/network/util.go @@ -2,7 +2,7 @@ package network import ( "encoding/json" - "io/ioutil" + "os" "path/filepath" "time" @@ -200,7 +200,7 @@ func writeFile(name string, dir string, contents []byte) error { return err } - err = ioutil.WriteFile(file, contents, 0o644) //nolint: gosec + err = os.WriteFile(file, contents, 0o644) //nolint: gosec if err != nil { return err } diff --git a/x/data/client/tx.go b/x/data/client/tx.go index eb43d7a867..bb35303761 100644 --- a/x/data/client/tx.go +++ b/x/data/client/tx.go @@ -2,8 +2,8 @@ package client import ( "fmt" - "io/ioutil" "net/url" + "os" "strconv" "strings" @@ -231,7 +231,7 @@ func parseContentHashes(clientCtx client.Context, filePath string) ([]*data.Cont return nil, fmt.Errorf("file path is empty") } - bz, err := ioutil.ReadFile(filePath) + bz, err := os.ReadFile(filePath) if err != nil { return nil, err } diff --git a/x/data/client/util.go b/x/data/client/util.go index bc3c4ecb97..d27080fce1 100644 --- a/x/data/client/util.go +++ b/x/data/client/util.go @@ -2,7 +2,7 @@ package client import ( "fmt" - "io/ioutil" + "os" "strings" "github.com/gogo/protobuf/proto" @@ -41,7 +41,7 @@ func parseContentHash(clientCtx client.Context, filePath string) (*data.ContentH return nil, fmt.Errorf("file path is empty") } - bz, err := ioutil.ReadFile(filePath) + bz, err := os.ReadFile(filePath) if err != nil { return nil, err } diff --git a/x/data/go.mod b/x/data/go.mod index a3f7c3113c..5773a81c93 100644 --- a/x/data/go.mod +++ b/x/data/go.mod @@ -1,6 +1,6 @@ module github.com/regen-network/regen-ledger/x/data/v2 -go 1.18 +go 1.19 require ( cosmossdk.io/errors v1.0.0-beta.7 diff --git a/x/ecocredit/base/client/utils.go b/x/ecocredit/base/client/utils.go index bd4c9bf8d2..a0bf2c6195 100644 --- a/x/ecocredit/base/client/utils.go +++ b/x/ecocredit/base/client/utils.go @@ -3,7 +3,7 @@ package client import ( "bytes" "encoding/json" - "io/ioutil" + "os" "github.com/gogo/protobuf/proto" "github.com/spf13/cobra" @@ -42,7 +42,7 @@ func mkQueryClient(cmd *cobra.Command) (types.QueryClient, sdkclient.Context, er } func parseMsgCreateBatch(clientCtx sdkclient.Context, jsonFile string) (*types.MsgCreateBatch, error) { - bz, err := ioutil.ReadFile(jsonFile) + bz, err := os.ReadFile(jsonFile) if err != nil { return nil, err } @@ -61,7 +61,7 @@ func parseMsgCreateBatch(clientCtx sdkclient.Context, jsonFile string) (*types.M } func parseCredits(jsonFile string) ([]*types.Credits, error) { - bz, err := ioutil.ReadFile(jsonFile) + bz, err := os.ReadFile(jsonFile) if err != nil { return nil, err } @@ -82,7 +82,7 @@ func parseCredits(jsonFile string) ([]*types.Credits, error) { } func parseSendCredits(jsonFile string) ([]*types.MsgSend_SendCredits, error) { - bz, err := ioutil.ReadFile(jsonFile) + bz, err := os.ReadFile(jsonFile) if err != nil { return nil, err } diff --git a/x/ecocredit/basket/client/util.go b/x/ecocredit/basket/client/util.go index c3c2a65f4b..9de3478375 100644 --- a/x/ecocredit/basket/client/util.go +++ b/x/ecocredit/basket/client/util.go @@ -3,7 +3,7 @@ package client import ( "bytes" "encoding/json" - "io/ioutil" + "os" "github.com/spf13/cobra" @@ -20,7 +20,7 @@ func txFlags(cmd *cobra.Command) *cobra.Command { } func parseBasketCredits(creditsFile string) ([]*types.BasketCredit, error) { - bz, err := ioutil.ReadFile(creditsFile) + bz, err := os.ReadFile(creditsFile) if err != nil { return nil, err } diff --git a/x/ecocredit/go.mod b/x/ecocredit/go.mod index c13b5e6f8b..f7fed4a3ab 100644 --- a/x/ecocredit/go.mod +++ b/x/ecocredit/go.mod @@ -1,6 +1,6 @@ module github.com/regen-network/regen-ledger/x/ecocredit/v3 -go 1.18 +go 1.19 require ( cosmossdk.io/errors v1.0.0-beta.7 diff --git a/x/ecocredit/marketplace/client/util.go b/x/ecocredit/marketplace/client/util.go index 9d5bfdc037..32925b4224 100644 --- a/x/ecocredit/marketplace/client/util.go +++ b/x/ecocredit/marketplace/client/util.go @@ -3,7 +3,7 @@ package client import ( "bytes" "encoding/json" - "io/ioutil" + "os" "github.com/spf13/cobra" @@ -20,7 +20,7 @@ func txFlags(cmd *cobra.Command) *cobra.Command { } func parseSellOrders(jsonFile string) ([]*types.MsgSell_Order, error) { - bz, err := ioutil.ReadFile(jsonFile) + bz, err := os.ReadFile(jsonFile) if err != nil { return nil, err } @@ -41,7 +41,7 @@ func parseSellOrders(jsonFile string) ([]*types.MsgSell_Order, error) { } func parseSellUpdates(jsonFile string) ([]*types.MsgUpdateSellOrders_Update, error) { - bz, err := ioutil.ReadFile(jsonFile) + bz, err := os.ReadFile(jsonFile) if err != nil { return nil, err } @@ -62,7 +62,7 @@ func parseSellUpdates(jsonFile string) ([]*types.MsgUpdateSellOrders_Update, err } func parseBuyOrders(jsonFile string) ([]*types.MsgBuyDirect_Order, error) { - bz, err := ioutil.ReadFile(jsonFile) + bz, err := os.ReadFile(jsonFile) if err != nil { return nil, err } diff --git a/x/intertx/go.mod b/x/intertx/go.mod index cb4aa48fb9..0ceb2ac7f4 100644 --- a/x/intertx/go.mod +++ b/x/intertx/go.mod @@ -1,6 +1,6 @@ module github.com/regen-network/regen-ledger/x/intertx -go 1.18 +go 1.19 require ( cosmossdk.io/errors v1.0.0-beta.7