Upgrade go version to 1.20 (#1246)

* Upgrade go version

Signed-off-by: letmerecall <girishsharma001@gmail.com>

* Upgrade go patch version to get through ci cache

Signed-off-by: letmerecall <girishsharma001@gmail.com>

* Format error message correctly

Signed-off-by: letmerecall <girishsharma001@gmail.com>

* Setup go from go.mod

Signed-off-by: letmerecall <girishsharma001@gmail.com>

* Fix workflow, checkout code before go setup

Signed-off-by: letmerecall <girishsharma001@gmail.com>

* Fix workflow

Signed-off-by: letmerecall <girishsharma001@gmail.com>

---------

Signed-off-by: letmerecall <girishsharma001@gmail.com>
Signed-off-by: Girish Sharma <girishsharma001@gmail.com>
This commit is contained in:
Girish Sharma 2023-03-02 02:41:17 +05:30 committed by GitHub
parent 398eb7e24a
commit 17124ebbe9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
10 changed files with 42 additions and 44 deletions

View File

@ -29,7 +29,6 @@ jobs:
name: Build ${{ matrix.target_os }}_${{ matrix.target_arch }} binaries
runs-on: ${{ matrix.os }}
env:
GOVER: 1.19.6
GOLANG_CI_LINT_VER: v1.51.2
GOOS: ${{ matrix.target_os }}
GOARCH: ${{ matrix.target_arch }}
@ -57,12 +56,13 @@ jobs:
- os: macOS-latest
target_arch: arm
steps:
- name: Set up Go ${{ env.GOVER }}
uses: actions/setup-go@v3
with:
go-version: ${{ env.GOVER }}
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
id: setup-go
with:
go-version-file: 'go.mod'
- name: Cache Go modules (Linux)
if: matrix.target_os == 'linux'
uses: actions/cache@v3
@ -70,9 +70,9 @@ jobs:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-
- name: Cache Go modules (Windows)
if: matrix.target_os == 'windows'
uses: actions/cache@v3
@ -80,9 +80,9 @@ jobs:
path: |
~\AppData\Local\go-build
~\go\pkg\mod
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-
- name: Cache Go modules (macOS)
if: matrix.target_os == 'darwin'
uses: actions/cache@v3
@ -90,9 +90,9 @@ jobs:
path: |
~/Library/Caches/go-build
~/go/pkg/mod
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-
- name: Run golangci-lint
if: matrix.target_arch == 'amd64' && matrix.target_os == 'linux'
uses: golangci/golangci-lint-action@v3.2.0

View File

@ -50,7 +50,6 @@ jobs:
name: E2E tests for K8s (KinD)
runs-on: ubuntu-latest
env:
GOVER: 1.19.6
DAPR_RUNTIME_PINNED_VERSION: 1.10.0
DAPR_DASHBOARD_PINNED_VERSION: 0.12.0
DAPR_RUNTIME_LATEST_STABLE_VERSION:
@ -80,23 +79,24 @@ jobs:
kind-version: v0.16.0
kind-image-sha: sha256:9be91e9e9cdf116809841fc77ebdb8845443c4c72fe5218f3ae9eb57fdb4bace
steps:
- name: Set up Go ${{ env.GOVER }}
uses: actions/setup-go@v3
with:
go-version: ${{ env.GOVER }}
- name: Check out code onto GOPATH
uses: actions/checkout@v3
with:
path: ./src/github.com/dapr/cli
- name: Set up Go
uses: actions/setup-go@v3
id: setup-go
with:
go-version-file: './src/github.com/dapr/cli/go.mod'
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
key: ${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ env.GOVER }}-
${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ steps.setup-go.outputs.go-version }}-
- name: Configure KinD
# Generate a KinD configuration file that uses:

View File

@ -35,7 +35,6 @@ jobs:
name: Run Self-Hosted E2E tests in ${{ matrix.target_os }}_${{ matrix.target_arch }}_${{ matrix.dapr_install_mode }}
runs-on: ${{ matrix.os }}
env:
GOVER: 1.19.6
GOOS: ${{ matrix.target_os }}
GOARCH: ${{ matrix.target_arch }}
GOPROXY: https://proxy.golang.org
@ -60,12 +59,13 @@ jobs:
- os: windows-latest
dapr_install_mode: complete
steps:
- name: Set up Go ${{ env.GOVER }}
uses: actions/setup-go@v3
with:
go-version: ${{ env.GOVER }}
- name: Check out code into the Go module directory
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
id: setup-go
with:
go-version-file: 'go.mod'
- name: Cache Go modules (Linux)
if: matrix.target_os == 'linux'
uses: actions/cache@v3
@ -73,9 +73,9 @@ jobs:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-
- name: Cache Go modules (Windows)
if: matrix.target_os == 'windows'
uses: actions/cache@v3
@ -83,9 +83,9 @@ jobs:
path: |
~\AppData\Local\go-build
~\go\pkg\mod
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-
- name: Cache Go modules (macOS)
if: matrix.target_os == 'darwin'
uses: actions/cache@v3
@ -93,9 +93,9 @@ jobs:
path: |
~/Library/Caches/go-build
~/go/pkg/mod
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
key: ${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ env.GOVER }}-
${{ matrix.target_os }}-${{ matrix.target_arch }}-go-${{ steps.setup-go.outputs.go-version }}-
- name: Install podman - MacOS
if: matrix.os == 'macos-latest' && matrix.dapr_install_mode == 'complete'
run: |

View File

@ -49,8 +49,6 @@ jobs:
kubernetes-e2e:
name: Upgrade path tests (KinD)
runs-on: ubuntu-latest
env:
GOVER: 1.19.6
strategy:
fail-fast: false # Keep running if one leg fails.
matrix:
@ -75,23 +73,24 @@ jobs:
kind-version: v0.16.0
kind-image-sha: sha256:9be91e9e9cdf116809841fc77ebdb8845443c4c72fe5218f3ae9eb57fdb4bace
steps:
- name: Set up Go ${{ env.GOVER }}
uses: actions/setup-go@v3
with:
go-version: ${{ env.GOVER }}
- name: Check out code onto GOPATH
uses: actions/checkout@v3
with:
path: ./src/github.com/dapr/cli
- name: Set up Go
uses: actions/setup-go@v3
id: setup-go
with:
go-version-file: './src/github.com/dapr/cli/go.mod'
- name: Cache Go modules
uses: actions/cache@v3
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ env.GOVER }}-${{ hashFiles('**/go.sum') }}
key: ${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ steps.setup-go.outputs.go-version }}-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ env.GOVER }}-
${{ matrix.k8s-version }}-${{ matrix.kind-version }}-go-${{ steps.setup-go.outputs.go-version }}-
- name: Configure KinD

View File

@ -200,7 +200,7 @@ e2e-build-run-sh: build test-e2e-sh
################################################################################
.PHONY: modtidy
modtidy:
go mod tidy -compat=1.19
go mod tidy -compat=1.20
################################################################################
# Target: check-diff #

View File

@ -7,7 +7,7 @@ This document helps you get started developing Dapr CLI. If you find any problem
### Linux and MacOS
1. The Go language environment `1.19` [(instructions)](https://golang.org/doc/install#tarball).
1. The Go language environment `1.20` [(instructions)](https://golang.org/doc/install#tarball).
* Make sure that your GOPATH and PATH are configured correctly
```bash
export GOPATH=~/go

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/dapr/cli
go 1.19
go 1.20
require (
github.com/Azure/go-autorest/autorest v0.11.28 // indirect

View File

@ -113,8 +113,7 @@ func Uninstall(uninstallAll bool, dockerNetwork string, containerRuntime string,
// TODO move to use errors.Join once we move to go 1.20.
for _, e := range containerErrs {
// For 1.19 only one %w is allowed.
err = fmt.Errorf("%w \n %s", err, e) //nolint: errorlint
err = fmt.Errorf("%w \n %w", err, e)
}
return err
}

View File

@ -1,3 +1,3 @@
module emit-metrics
go 1.19
go 1.20

View File

@ -1,3 +1,3 @@
module processor
go 1.19
go 1.20