1
0
mirror of https://github.com/SAP/jenkins-library.git synced 2025-02-21 19:48:53 +02:00

Reduce go binary size by updating to go 1.15 (#1968)

* Update go to 1.15 to reduce binary size

Go made improvements to reduce binary size, cf https://golang.org/doc/go1.15

> Go 1.15 reduces typical binary sizes by around 5% compared to Go 1.14 by eliminating certain types of GC metadata and more aggressively eliminating unused type metadata.

In my test, this equates to about 3 mb diff between Go 1.13 and Go 1.15:

-rwxr-xr-x 1 root root 36M Aug 31 14:43 piper-go-113
-rwxr-xr-x 1 root root 33M Aug 31 14:44 piper-go-115

* Go Generate

* go mod tidy

Co-authored-by: Stephan Aßmus <stephan.assmus@sap.com>
Co-authored-by: Oliver Nocon <33484802+OliverNocon@users.noreply.github.com>
This commit is contained in:
Florian Wilhelm 2020-09-17 08:44:42 +02:00 committed by GitHub
parent d589038206
commit 485faed812
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
9 changed files with 12 additions and 12 deletions

View File

@ -21,7 +21,7 @@ jobs:
- uses: actions/setup-go@v1
with:
go-version: '1.13.x'
go-version: '1.15.x'
- name: Install Groovy
run: sudo apt-get update && sudo apt-get install groovy -y

View File

@ -76,7 +76,7 @@ jobs:
curl --location --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ steps.commitId.outputs.commitId }}' -H 'Content-Type: application/json' --data '{"state": "pending", "context": "Go / integration-tests", "target_url": "https://github.com/SAP/jenkins-library/actions/runs/${{ github.run_id }}"}' -H 'Authorization: token ${{secrets.INTEGRATION_TEST_VOTING_TOKEN}}'
- uses: actions/setup-go@v1
with:
go-version: '1.13.x'
go-version: '1.15.x'
- name: build
env:
CGO_ENABLED: 0

View File

@ -55,7 +55,7 @@ jobs:
curl --location --request POST 'https://api.github.com/repos/SAP/jenkins-library/statuses/${{ steps.commitId.outputs.commitId }}' -H 'Content-Type: application/json' --data '{"state": "pending", "context": "Go / integration-tests", "target_url": "https://github.com/SAP/jenkins-library/actions/runs/${{ github.run_id }}"}' -H 'Authorization: token ${{secrets.INTEGRATION_TEST_VOTING_TOKEN}}'
- uses: actions/setup-go@v1
with:
go-version: '1.13.x'
go-version: '1.15.x'
- name: build
env:
CGO_ENABLED: 0

View File

@ -15,7 +15,7 @@ jobs:
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: '1.13.x'
go-version: '1.15.x'
- name: Perform update
run: |
git checkout -B gh-action-update-golang-dependencies

View File

@ -12,7 +12,7 @@ jobs:
- uses: actions/checkout@v1
- uses: actions/setup-go@v1
with:
go-version: '1.13.x'
go-version: '1.15.x'
- env:
CGO_ENABLED: 0
run: |

View File

@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/setup-go@v1
with:
go-version: '1.13.x'
go-version: '1.15.x'
- name: Cache Golang Packages
uses: actions/cache@v1
with:
@ -38,7 +38,7 @@ jobs:
steps:
- uses: actions/setup-go@v1
with:
go-version: '1.13.x'
go-version: '1.15.x'
- name: Cache Golang Packages
uses: actions/cache@v1
with:
@ -58,7 +58,7 @@ jobs:
steps:
- uses: actions/setup-go@v1
with:
go-version: '1.13.x'
go-version: '1.15.x'
- name: Cache Golang Packages
uses: actions/cache@v1
with:
@ -78,7 +78,7 @@ jobs:
steps:
- uses: actions/setup-go@v1
with:
go-version: '1.13.x'
go-version: '1.15.x'
- name: Cache Golang Packages
uses: actions/cache@v1
with:

View File

@ -1,4 +1,4 @@
FROM golang:1.13 AS build-env
FROM golang:1.15 AS build-env
COPY . /build
WORKDIR /build

2
go.mod
View File

@ -1,6 +1,6 @@
module github.com/SAP/jenkins-library
go 1.13
go 1.15
require (
github.com/360EntSecGroup-Skylar/excelize/v2 v2.3.0

View File

@ -25,7 +25,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.13', dockerOptions: '-u 0', dockerEnvVars: [
steps.dockerExecute(script: steps, dockerImage: 'golang:1.15', dockerOptions: '-u 0', dockerEnvVars: [
REPOSITORY_UNDER_TEST: steps.env.REPOSITORY_UNDER_TEST,
LIBRARY_VERSION_UNDER_TEST: steps.env.LIBRARY_VERSION_UNDER_TEST
]) {