You've already forked sap-jenkins-library
mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-09-16 09:26:22 +02:00
update golang to 1.20 (#4783)
* update golang to 1.20 * update version in another places * fix failing unit tests and lint --------- Co-authored-by: Gulom Alimov <gulomjon.alimov@sap.com>
This commit is contained in:
2
.github/workflows/documentation.yml
vendored
2
.github/workflows/documentation.yml
vendored
@@ -23,7 +23,7 @@ jobs:
|
||||
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.19.x'
|
||||
go-version: '1.20.x'
|
||||
|
||||
- name: Install Groovy
|
||||
run: sudo apt-get update && sudo apt-get install groovy -y
|
||||
|
2
.github/workflows/update-go-dependencies.yml
vendored
2
.github/workflows/update-go-dependencies.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.19.x'
|
||||
go-version: '1.20.x'
|
||||
- name: Perform update
|
||||
run: |
|
||||
git checkout -B gh-action-update-golang-dependencies
|
||||
|
2
.github/workflows/upload-go-master.yml
vendored
2
.github/workflows/upload-go-master.yml
vendored
@@ -13,7 +13,7 @@ jobs:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.19.x'
|
||||
go-version: '1.20.x'
|
||||
- env:
|
||||
CGO_ENABLED: 0
|
||||
run: |
|
||||
|
12
.github/workflows/verify-go.yml
vendored
12
.github/workflows/verify-go.yml
vendored
@@ -15,7 +15,7 @@ jobs:
|
||||
- uses: styfle/cancel-workflow-action@0.11.0
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.19.x'
|
||||
go-version: '1.20.x'
|
||||
- name: Cache Golang Packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
@@ -43,7 +43,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.19.x'
|
||||
go-version: '1.20.x'
|
||||
- name: Cache Golang Packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
@@ -63,8 +63,8 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.19.x'
|
||||
# action requires go@1.19
|
||||
go-version: '1.20.x'
|
||||
# action requires go@1.20
|
||||
- name: checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
@@ -79,7 +79,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.19.x'
|
||||
go-version: '1.20.x'
|
||||
- name: Cache Golang Packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
@@ -99,7 +99,7 @@ jobs:
|
||||
steps:
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: '1.19.x'
|
||||
go-version: '1.20.x'
|
||||
- name: Cache Golang Packages
|
||||
uses: actions/cache@v3
|
||||
with:
|
||||
|
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.19 AS build-env
|
||||
FROM golang:1.20 AS build-env
|
||||
COPY . /build
|
||||
WORKDIR /build
|
||||
|
||||
|
2
go.mod
2
go.mod
@@ -1,6 +1,6 @@
|
||||
module github.com/SAP/jenkins-library
|
||||
|
||||
go 1.19
|
||||
go 1.20
|
||||
|
||||
//downgraded for :https://cs.opensource.google/go/x/crypto/+/5d542ad81a58c89581d596f49d0ba5d435481bcf : or else will break for some github instances
|
||||
// not downgraded using go get since it breaks other dependencies.
|
||||
|
@@ -1,5 +1,5 @@
|
||||
module github.com/example/golang-app
|
||||
|
||||
go 1.19
|
||||
go 1.20
|
||||
|
||||
require github.com/gorilla/mux v1.8.0
|
||||
|
@@ -1,3 +1,3 @@
|
||||
module github.com/example/golang-app
|
||||
|
||||
go 1.19
|
||||
go 1.20
|
||||
|
@@ -44,9 +44,9 @@ func TestShellRun(t *testing.T) {
|
||||
}
|
||||
})
|
||||
t.Run("stderr", func(t *testing.T) {
|
||||
expectedErr := "Stderr: command /bin/bash\n"
|
||||
if eStr := e.String(); eStr != expectedErr {
|
||||
t.Errorf("expected: %v got: %v", expectedErr, eStr)
|
||||
expectedErr := "Stderr: command /bin/bash"
|
||||
if !strings.Contains(e.String(), expectedErr) {
|
||||
t.Errorf("expected: %v got: %v", expectedErr, e.String())
|
||||
}
|
||||
})
|
||||
})
|
||||
@@ -74,9 +74,9 @@ func TestExecutableRun(t *testing.T) {
|
||||
}
|
||||
})
|
||||
t.Run("stderr", func(t *testing.T) {
|
||||
expectedErr := "Stderr: command echo\n"
|
||||
if eStr := stderr.String(); eStr != expectedErr {
|
||||
t.Errorf("expected: %v got: %v", expectedErr, eStr)
|
||||
expectedErr := "Stderr: command echo"
|
||||
if !strings.Contains(stderr.String(), expectedErr) {
|
||||
t.Errorf("expected: %v got: %v", expectedErr, stderr.String())
|
||||
}
|
||||
})
|
||||
})
|
||||
|
@@ -77,7 +77,7 @@ func TestSend(t *testing.T) {
|
||||
|
||||
// then
|
||||
assert.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "lookup proxy.dummy.sap.com: no such host")
|
||||
assert.Contains(t, err.Error(), "no such host")
|
||||
assert.Nil(t, response)
|
||||
})
|
||||
}
|
||||
|
@@ -561,7 +561,7 @@ func (f *FilesMock) CreateArchive(content map[string][]byte) ([]byte, error) {
|
||||
err := tw.WriteHeader(&tar.Header{
|
||||
Name: fileName,
|
||||
Size: int64(len(fileContent)),
|
||||
Typeflag: tar.TypeRegA,
|
||||
Typeflag: tar.TypeReg,
|
||||
})
|
||||
|
||||
if err != nil {
|
||||
|
@@ -30,7 +30,7 @@ class PiperGoUtils implements Serializable {
|
||||
|
||||
if (steps.env.REPOSITORY_UNDER_TEST && steps.env.LIBRARY_VERSION_UNDER_TEST) {
|
||||
steps.echo("Running in a consumer test, building unit-under-test binary for verification.")
|
||||
steps.dockerExecute(script: steps, dockerImage: 'golang:1.19', dockerOptions: '-u 0', dockerEnvVars: [
|
||||
steps.dockerExecute(script: steps, dockerImage: 'golang:1.20', dockerOptions: '-u 0', dockerEnvVars: [
|
||||
REPOSITORY_UNDER_TEST: steps.env.REPOSITORY_UNDER_TEST,
|
||||
LIBRARY_VERSION_UNDER_TEST: steps.env.LIBRARY_VERSION_UNDER_TEST
|
||||
]) {
|
||||
|
Reference in New Issue
Block a user