Skip to content

Commit 077ecfe

Browse files
m1ron0xFFEgor Balakin
and
Egor Balakin
authored
feat: bump go to 1.21 (#4846)
* bump go to 1.21, add toolchain go1.21.7 * bump go to 1.21 * fix test --------- Co-authored-by: Egor Balakin <[email protected]>
1 parent df0b288 commit 077ecfe

File tree

11 files changed

+70
-19
lines changed

11 files changed

+70
-19
lines changed

.github/workflows/documentation.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323

2424
- uses: actions/setup-go@v5
2525
with:
26-
go-version: '1.20.x'
26+
go-version: '1.21.x'
2727

2828
- name: Install Groovy
2929
run: sudo apt-get update && sudo apt-get install groovy -y

.github/workflows/update-go-dependencies.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v4
1414
- uses: actions/setup-go@v5
1515
with:
16-
go-version: '1.20.x'
16+
go-version: '1.21.x'
1717
- name: Perform update
1818
run: |
1919
git checkout -B gh-action-update-golang-dependencies

.github/workflows/upload-go-master.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ jobs:
1313
- uses: actions/checkout@v4
1414
- uses: actions/setup-go@v5
1515
with:
16-
go-version: '1.20.x'
16+
go-version: '1.21.x'
1717
- env:
1818
CGO_ENABLED: 0
1919
run: |

.github/workflows/verify-go.yml

+5-6
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- uses: styfle/[email protected]
1616
- uses: actions/setup-go@v5
1717
with:
18-
go-version: '1.20.x'
18+
go-version: '1.21.x'
1919
- name: Cache Golang Packages
2020
uses: actions/cache@v3
2121
with:
@@ -43,7 +43,7 @@ jobs:
4343
steps:
4444
- uses: actions/setup-go@v5
4545
with:
46-
go-version: '1.20.x'
46+
go-version: '1.21.x'
4747
- name: Cache Golang Packages
4848
uses: actions/cache@v3
4949
with:
@@ -63,8 +63,7 @@ jobs:
6363
steps:
6464
- uses: actions/setup-go@v5
6565
with:
66-
go-version: '1.20.x'
67-
# action requires [email protected]
66+
go-version: '1.21.x'
6867
- name: checkout
6968
uses: actions/checkout@v4
7069
with:
@@ -79,7 +78,7 @@ jobs:
7978
steps:
8079
- uses: actions/setup-go@v5
8180
with:
82-
go-version: '1.20.x'
81+
go-version: '1.21.x'
8382
- name: Cache Golang Packages
8483
uses: actions/cache@v3
8584
with:
@@ -99,7 +98,7 @@ jobs:
9998
steps:
10099
- uses: actions/setup-go@v5
101100
with:
102-
go-version: '1.20.x'
101+
go-version: '1.21.x'
103102
- name: Cache Golang Packages
104103
uses: actions/cache@v3
105104
with:

Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.20 AS build-env
1+
FROM golang:1.21 AS build-env
22
COPY . /build
33
WORKDIR /build
44

go.mod

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
module github.com/SAP/jenkins-library
22

3-
go 1.20
3+
go 1.21
4+
5+
toolchain go1.21.9
46

57
// It is a locked dependency of github.com/buildpacks/[email protected]. The maintainers may remove the lock
68
// in future releases. Check if 'replace' statement still there in their go.mod file. Remove line below if not.

go.sum

+50
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
module github.com/example/golang-app
22

3-
go 1.20
3+
go 1.21
44

55
require github.com/gorilla/mux v1.8.0
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module github.com/example/golang-app
22

3-
go 1.20
3+
go 1.21

pkg/http/http_cert_logon_test.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ func TestCertificateLogon(t *testing.T) {
8787

8888
clientPemKey, clientPemCert := GenerateSelfSignedClientAuthCertificate()
8989

90-
//server
90+
// server
9191
clientCertPool := x509.NewCertPool()
9292
clientCertPool.AppendCertsFromPEM(clientPemCert)
9393

@@ -102,7 +102,7 @@ func TestCertificateLogon(t *testing.T) {
102102
server.StartTLS()
103103
defer server.Close()
104104

105-
//client
105+
// client
106106
tlsKeyPair, err := tls.X509KeyPair(clientPemCert, clientPemKey)
107107
if err != nil {
108108
log.Fatal("Failed to create clients tls key pair")
@@ -131,7 +131,7 @@ func TestCertificateLogon(t *testing.T) {
131131
})
132132

133133
_, err := c.SendRequest("GET", server.URL, nil, nil, nil)
134-
assert.ErrorContains(t, err, "bad certificate")
134+
assert.ErrorContains(t, err, "certificate required")
135135
})
136136

137137
t.Run("Failure - Login with wrong certificate", func(t *testing.T) {
@@ -150,14 +150,14 @@ func TestCertificateLogon(t *testing.T) {
150150
})
151151

152152
_, err = c.SendRequest("GET", server.URL, nil, nil, nil)
153-
assert.ErrorContains(t, err, "bad certificate")
153+
assert.ErrorContains(t, err, "unknown certificate authority")
154154
})
155155

156156
t.Run("SanityCheck", func(t *testing.T) {
157157
client := &http.Client{
158158
Transport: &http.Transport{
159159
TLSClientConfig: &tls.Config{
160-
//RootCAs: certPool,
160+
// RootCAs: certPool,
161161
InsecureSkipVerify: true,
162162
Certificates: []tls.Certificate{tlsKeyPair},
163163
},

src/com/sap/piper/PiperGoUtils.groovy

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class PiperGoUtils implements Serializable {
3030

3131
if (steps.env.REPOSITORY_UNDER_TEST && steps.env.LIBRARY_VERSION_UNDER_TEST) {
3232
steps.echo("Running in a consumer test, building unit-under-test binary for verification.")
33-
steps.dockerExecute(script: steps, dockerImage: 'golang:1.20', dockerOptions: '-u 0', dockerEnvVars: [
33+
steps.dockerExecute(script: steps, dockerImage: 'golang:1.21', dockerOptions: '-u 0', dockerEnvVars: [
3434
REPOSITORY_UNDER_TEST: steps.env.REPOSITORY_UNDER_TEST,
3535
LIBRARY_VERSION_UNDER_TEST: steps.env.LIBRARY_VERSION_UNDER_TEST
3636
]) {

0 commit comments

Comments
 (0)