From 894250d392ba025e870134394b0c113f0fe5eb9e Mon Sep 17 00:00:00 2001 From: Ed Harrod Date: Wed, 13 Nov 2024 15:45:18 +0000 Subject: [PATCH] chore(manager/gomod): Update go version to 1.23.3 in tests/examples (#32514) Co-authored-by: Rhys Arkins --- docs/usage/golang.md | 6 +-- lib/modules/manager/asdf/extract.spec.ts | 4 +- .../custom/regex/__fixtures__/Dockerfile | 2 +- .../manager/dockerfile/extract.spec.ts | 6 +-- .../manager/gomod/__fixtures__/3/go-mod | 3 +- lib/modules/manager/gomod/artifacts.spec.ts | 54 +++++++++---------- lib/modules/manager/gomod/extract.spec.ts | 12 ++--- lib/modules/manager/gomod/line-parser.spec.ts | 8 +-- lib/modules/manager/gomod/readme.md | 2 +- lib/modules/manager/gomod/update.spec.ts | 2 +- 10 files changed, 49 insertions(+), 50 deletions(-) diff --git a/docs/usage/golang.md b/docs/usage/golang.md index 51b334ab624718..4394a5f4dcd957 100644 --- a/docs/usage/golang.md +++ b/docs/usage/golang.md @@ -67,16 +67,16 @@ By default, Renovate will keep up with the latest version of the `go` binary. You can force Renovate to use a specific version of Go by setting a constraint. -```json title="Getting Renovate to use the latest patch version of the 1.16 Go binary" +```json title="Getting Renovate to use the latest patch version of the 1.23 Go binary" { "constraints": { - "go": "1.16" + "go": "1.23" } } ``` We do not support patch level versions for the minimum `go` version. -This means you cannot use `go 1.16.6`, but you can use `go 1.16` as a constraint. +This means you cannot use `go 1.23.3`, but you can use `go 1.23` as a constraint. ### Custom registry support, and authentication diff --git a/lib/modules/manager/asdf/extract.spec.ts b/lib/modules/manager/asdf/extract.spec.ts index 576f46582493c6..ca71bc4c985bfa 100644 --- a/lib/modules/manager/asdf/extract.spec.ts +++ b/lib/modules/manager/asdf/extract.spec.ts @@ -73,7 +73,7 @@ github-cli 2.32.1 gitleaks 8.21.1 gleam 1.3.1 gohugo extended_0.104.3 -golang 1.19.2 +golang 1.23.3 golangci-lint 1.52.2 gomplate 3.11.7 hadolint 2.12.0 @@ -325,7 +325,7 @@ dummy 1.2.3 extractVersion: '^v(?\\S+)', }, { - currentValue: '1.19.2', + currentValue: '1.23.3', datasource: 'github-tags', packageName: 'golang/go', depName: 'golang', diff --git a/lib/modules/manager/custom/regex/__fixtures__/Dockerfile b/lib/modules/manager/custom/regex/__fixtures__/Dockerfile index cac5d01da33c7e..ed0437310798e9 100644 --- a/lib/modules/manager/custom/regex/__fixtures__/Dockerfile +++ b/lib/modules/manager/custom/regex/__fixtures__/Dockerfile @@ -131,7 +131,7 @@ RUN chmod +x /usr/local/bin/composer RUN apt-get update && apt-get install -y bzr mercurial && \ rm -rf /var/lib/apt/lists/* -ENV GOLANG_VERSION=1.13.4 +ENV GOLANG_VERSION=1.23.3 # Disable GOPROXY and GOSUMDB until we offer a solid solution to configure # private repositories. diff --git a/lib/modules/manager/dockerfile/extract.spec.ts b/lib/modules/manager/dockerfile/extract.spec.ts index ce1faec854d533..a16b0bb40c0008 100644 --- a/lib/modules/manager/dockerfile/extract.spec.ts +++ b/lib/modules/manager/dockerfile/extract.spec.ts @@ -463,7 +463,7 @@ describe('modules/manager/dockerfile/extract', () => { it('detects ["stage"] and ["final"] deps of docker multi-stage build.', () => { const res = extractPackageFile( - 'FROM node:8.15.1-alpine as skippedfrom\nFROM golang:1.7.3 as builder\n\n# comment\nWORKDIR /go/src/github.com/alexellis/href-counter/\nRUN go get -d -v golang.org/x/net/html \nCOPY app.go .\nRUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .\n\nFROM alpine:latest \nRUN apk --no-cache add ca-certificates\nWORKDIR /root/\nCOPY --from=builder /go/src/github.com/alexellis/href-counter/app .\nCMD ["./app"]\n', + 'FROM node:8.15.1-alpine as skippedfrom\nFROM golang:1.23.3 as builder\n\n# comment\nWORKDIR /go/src/github.com/alexellis/href-counter/\nRUN go get -d -v golang.org/x/net/html \nCOPY app.go .\nRUN CGO_ENABLED=0 GOOS=linux go build -a -installsuffix cgo -o app .\n\nFROM alpine:latest \nRUN apk --no-cache add ca-certificates\nWORKDIR /root/\nCOPY --from=builder /go/src/github.com/alexellis/href-counter/app .\nCMD ["./app"]\n', '', {}, )?.deps; @@ -482,11 +482,11 @@ describe('modules/manager/dockerfile/extract', () => { autoReplaceStringTemplate: '{{depName}}{{#if newValue}}:{{newValue}}{{/if}}{{#if newDigest}}@{{newDigest}}{{/if}}', currentDigest: undefined, - currentValue: '1.7.3', + currentValue: '1.23.3', datasource: 'docker', depName: 'golang', depType: 'stage', - replaceString: 'golang:1.7.3', + replaceString: 'golang:1.23.3', }, { autoReplaceStringTemplate: diff --git a/lib/modules/manager/gomod/__fixtures__/3/go-mod b/lib/modules/manager/gomod/__fixtures__/3/go-mod index 973a7c3dcee593..5829247f2c3531 100644 --- a/lib/modules/manager/gomod/__fixtures__/3/go-mod +++ b/lib/modules/manager/gomod/__fixtures__/3/go-mod @@ -1,6 +1,6 @@ module k8s.io/minikube -go 1.13 +go 1.23 require ( cloud.google.com/go v0.45.1 @@ -133,4 +133,3 @@ replace ( ) toolchain go1.22.1 - diff --git a/lib/modules/manager/gomod/artifacts.spec.ts b/lib/modules/manager/gomod/artifacts.spec.ts index 9246997792a3f2..308904a603356b 100644 --- a/lib/modules/manager/gomod/artifacts.spec.ts +++ b/lib/modules/manager/gomod/artifacts.spec.ts @@ -443,7 +443,7 @@ describe('modules/manager/gomod/artifacts', () => { fs.readLocalFile.mockResolvedValueOnce('New go.sum'); fs.readLocalFile.mockResolvedValueOnce(gomod1); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); expect( await gomod.updateArtifacts({ @@ -480,7 +480,7 @@ describe('modules/manager/gomod/artifacts', () => { '-w "/tmp/github/some/repo" ' + 'ghcr.io/containerbase/sidecar' + ' bash -l -c "' + - 'install-tool golang 1.14.0' + + 'install-tool golang 1.23.3' + ' && ' + 'go get -d -t ./...' + '"', @@ -505,7 +505,7 @@ describe('modules/manager/gomod/artifacts', () => { fs.readLocalFile.mockResolvedValueOnce('New go.sum'); fs.readLocalFile.mockResolvedValueOnce(gomod1); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); expect( await gomod.updateArtifacts({ @@ -524,7 +524,7 @@ describe('modules/manager/gomod/artifacts', () => { }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'install-tool golang 1.14.0' }, + { cmd: 'install-tool golang 1.23.3' }, { cmd: 'go get -d -t ./...', options: { @@ -595,7 +595,7 @@ describe('modules/manager/gomod/artifacts', () => { fs.readLocalFile.mockResolvedValueOnce('New go.sum'); fs.readLocalFile.mockResolvedValueOnce(gomod1); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); expect( await gomod.updateArtifacts({ @@ -645,7 +645,7 @@ describe('modules/manager/gomod/artifacts', () => { '-w "/tmp/github/some/repo" ' + 'ghcr.io/containerbase/sidecar' + ' bash -l -c "' + - 'install-tool golang 1.14.0' + + 'install-tool golang 1.23.3' + ' && ' + 'go get -d -t ./...' + '"', @@ -704,7 +704,7 @@ describe('modules/manager/gomod/artifacts', () => { fs.readLocalFile.mockResolvedValueOnce('New go.sum'); fs.readLocalFile.mockResolvedValueOnce(gomod1); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); expect( await gomod.updateArtifacts({ @@ -772,7 +772,7 @@ describe('modules/manager/gomod/artifacts', () => { fs.readLocalFile.mockResolvedValueOnce('New go.sum'); fs.readLocalFile.mockResolvedValueOnce(gomod1); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); expect( await gomod.updateArtifacts({ @@ -837,7 +837,7 @@ describe('modules/manager/gomod/artifacts', () => { fs.readLocalFile.mockResolvedValueOnce('New go.sum'); fs.readLocalFile.mockResolvedValueOnce(gomod1); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); expect( await gomod.updateArtifacts({ @@ -911,7 +911,7 @@ describe('modules/manager/gomod/artifacts', () => { fs.readLocalFile.mockResolvedValueOnce('New go.sum'); fs.readLocalFile.mockResolvedValueOnce(gomod1); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); expect( await gomod.updateArtifacts({ @@ -984,7 +984,7 @@ describe('modules/manager/gomod/artifacts', () => { fs.readLocalFile.mockResolvedValueOnce('New go.sum'); fs.readLocalFile.mockResolvedValueOnce(gomod1); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); expect( await gomod.updateArtifacts({ @@ -1065,7 +1065,7 @@ describe('modules/manager/gomod/artifacts', () => { fs.readLocalFile.mockResolvedValueOnce('New go.sum'); fs.readLocalFile.mockResolvedValueOnce(gomod1); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); expect( await gomod.updateArtifacts({ @@ -1120,7 +1120,7 @@ describe('modules/manager/gomod/artifacts', () => { fs.readLocalFile.mockResolvedValueOnce('New go.sum 3'); fs.readLocalFile.mockResolvedValueOnce('New go.mod'); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); expect( await gomod.updateArtifacts({ @@ -1155,7 +1155,7 @@ describe('modules/manager/gomod/artifacts', () => { '-w "/tmp/github/some/repo" ' + 'ghcr.io/containerbase/sidecar' + ' bash -l -c "' + - 'install-tool golang 1.14.0' + + 'install-tool golang 1.23.3' + ' && ' + 'go get -d -t ./...' + ' && ' + @@ -1184,7 +1184,7 @@ describe('modules/manager/gomod/artifacts', () => { fs.readLocalFile.mockResolvedValueOnce('New go.sum 3'); fs.readLocalFile.mockResolvedValueOnce('New go.mod'); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); expect( await gomod.updateArtifacts({ @@ -1219,7 +1219,7 @@ describe('modules/manager/gomod/artifacts', () => { '-w "/tmp/github/some/repo" ' + 'ghcr.io/containerbase/sidecar' + ' bash -l -c "' + - 'install-tool golang 1.14.0' + + 'install-tool golang 1.23.3' + ' && ' + 'go get -d -t ./...' + ' && ' + @@ -1248,7 +1248,7 @@ describe('modules/manager/gomod/artifacts', () => { fs.readLocalFile.mockResolvedValueOnce('New go.sum 3'); fs.readLocalFile.mockResolvedValueOnce('New go.mod'); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); expect( await gomod.updateArtifacts({ @@ -1283,7 +1283,7 @@ describe('modules/manager/gomod/artifacts', () => { '-w "/tmp/github/some/repo" ' + 'ghcr.io/containerbase/sidecar' + ' bash -l -c "' + - 'install-tool golang 1.14.0' + + 'install-tool golang 1.23.3' + ' && ' + 'go get -d -t ./...' + ' && ' + @@ -1312,7 +1312,7 @@ describe('modules/manager/gomod/artifacts', () => { fs.readLocalFile.mockResolvedValueOnce('New go.sum 3'); fs.readLocalFile.mockResolvedValueOnce('New go.mod'); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); expect( await gomod.updateArtifacts({ @@ -1347,7 +1347,7 @@ describe('modules/manager/gomod/artifacts', () => { '-w "/tmp/github/some/repo" ' + 'ghcr.io/containerbase/sidecar' + ' bash -l -c "' + - 'install-tool golang 1.14.0' + + 'install-tool golang 1.23.3' + ' && ' + 'go get -d -t ./...' + ' && ' + @@ -1905,7 +1905,7 @@ describe('modules/manager/gomod/artifacts', () => { .mockResolvedValueOnce('New main.go') .mockResolvedValueOnce('New go.mod'); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); const res = await gomod.updateArtifacts({ packageFileName: 'go.mod', @@ -1924,7 +1924,7 @@ describe('modules/manager/gomod/artifacts', () => { { file: { type: 'addition', path: 'go.mod', contents: 'New go.mod' } }, ]); expect(execSnapshots).toMatchObject([ - { cmd: 'install-tool golang 1.14.0' }, + { cmd: 'install-tool golang 1.23.3' }, { cmd: 'go get -d -t ./...', options: { cwd: '/tmp/github/some/repo' }, @@ -1964,7 +1964,7 @@ describe('modules/manager/gomod/artifacts', () => { .mockResolvedValueOnce('New main.go') .mockResolvedValueOnce('New go.mod'); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); const res = await gomod.updateArtifacts({ packageFileName: 'go.mod', @@ -2004,7 +2004,7 @@ describe('modules/manager/gomod/artifacts', () => { '-w "/tmp/github/some/repo" ' + 'ghcr.io/containerbase/sidecar' + ' bash -l -c "' + - 'install-tool golang 1.17.0' + + 'install-tool golang 1.23.3' + ' && ' + 'go get -d -t ./...' + ' && ' + @@ -2038,7 +2038,7 @@ describe('modules/manager/gomod/artifacts', () => { .mockResolvedValueOnce('New main.go') .mockResolvedValueOnce('New go.mod'); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); const res = await gomod.updateArtifacts({ packageFileName: 'go.mod', @@ -2077,7 +2077,7 @@ describe('modules/manager/gomod/artifacts', () => { .mockResolvedValueOnce('New main.go') .mockResolvedValueOnce('New go.mod'); datasource.getPkgReleases.mockResolvedValueOnce({ - releases: [{ version: '1.17.0' }, { version: '1.14.0' }], + releases: [{ version: '1.17.0' }, { version: '1.23.3' }], }); const res = await gomod.updateArtifacts({ packageFileName: 'go.mod', @@ -2119,7 +2119,7 @@ describe('modules/manager/gomod/artifacts', () => { '-w "/tmp/github/some/repo" ' + 'ghcr.io/containerbase/sidecar' + ' bash -l -c "' + - 'install-tool golang 1.14.0' + + 'install-tool golang 1.23.3' + ' && ' + 'go get -d -t ./...' + ' && ' + diff --git a/lib/modules/manager/gomod/extract.spec.ts b/lib/modules/manager/gomod/extract.spec.ts index 97d093d62b4ac6..e5d063f83afbb4 100644 --- a/lib/modules/manager/gomod/extract.spec.ts +++ b/lib/modules/manager/gomod/extract.spec.ts @@ -46,7 +46,7 @@ describe('modules/manager/gomod/extract', () => { it('extracts replace directives from multi-line and single line', () => { const goMod = codeBlock` module github.com/renovate-tests/gomod - go 1.18 + go 1.23 replace golang.org/x/foo => github.com/pravesht/gocql v0.0.0 replace ( k8s.io/client-go => k8s.io/client-go v0.21.9 @@ -66,7 +66,7 @@ describe('modules/manager/gomod/extract', () => { }, depName: 'go', depType: 'golang', - currentValue: '1.18', + currentValue: '1.23', datasource: 'golang-version', versioning: 'go-mod-directive', }, @@ -127,8 +127,8 @@ describe('modules/manager/gomod/extract', () => { it('extracts the toolchain directive', () => { const goMod = codeBlock` module github.com/renovate-tests/gomod - go 1.21 - toolchain go1.21.7 + go 1.23 + toolchain go1.23.3 replace golang.org/x/foo => github.com/pravesht/gocql v0.0.0 `; const res = extractPackageFile(goMod); @@ -140,7 +140,7 @@ describe('modules/manager/gomod/extract', () => { }, depName: 'go', depType: 'golang', - currentValue: '1.21', + currentValue: '1.23', datasource: 'golang-version', versioning: 'go-mod-directive', }, @@ -150,7 +150,7 @@ describe('modules/manager/gomod/extract', () => { }, depName: 'go', depType: 'toolchain', - currentValue: '1.21.7', + currentValue: '1.23.3', datasource: 'golang-version', }, { diff --git a/lib/modules/manager/gomod/line-parser.spec.ts b/lib/modules/manager/gomod/line-parser.spec.ts index 11beed76cf86cc..a7ad513712c6e1 100644 --- a/lib/modules/manager/gomod/line-parser.spec.ts +++ b/lib/modules/manager/gomod/line-parser.spec.ts @@ -6,10 +6,10 @@ describe('modules/manager/gomod/line-parser', () => { }); it('should parse go version', () => { - const line = 'go 1.16'; + const line = 'go 1.23'; const res = parseLine(line); expect(res).toStrictEqual({ - currentValue: '1.16', + currentValue: '1.23', datasource: 'golang-version', depName: 'go', depType: 'golang', @@ -31,10 +31,10 @@ describe('modules/manager/gomod/line-parser', () => { }); it('should parse toolchain version', () => { - const line = 'toolchain go1.16'; + const line = 'toolchain go1.23'; const res = parseLine(line); expect(res).toStrictEqual({ - currentValue: '1.16', + currentValue: '1.23', datasource: 'golang-version', depName: 'go', depType: 'toolchain', diff --git a/lib/modules/manager/gomod/readme.md b/lib/modules/manager/gomod/readme.md index 34dc5df94f2862..d5a97547b768f2 100644 --- a/lib/modules/manager/gomod/readme.md +++ b/lib/modules/manager/gomod/readme.md @@ -16,7 +16,7 @@ You might be interested in the following `postUpdateOptions`: 1. `gomodMassage` - to enable massaging of all `replace` statements prior to running `go` so that they will be ignored When Renovate is running using `binarySource=docker` (such as in the Mend Renovate App) then it will pick the latest compatible version of Go to run, i.e. the latest `1.x` release. -Even if the `go.mod` has a version like `go 1.14`, Renovate will treat it as a `^1.14` constraint and not `=1.14`. +Even if the `go.mod` has a version like `go 1.22`, Renovate will treat it as a `^1.22` constraint and not `=1.22`. Indirect updates are disabled by default. To enable them, add a package rule such as: diff --git a/lib/modules/manager/gomod/update.spec.ts b/lib/modules/manager/gomod/update.spec.ts index c6cce004636d5a..28b9e2c5b23c9f 100644 --- a/lib/modules/manager/gomod/update.spec.ts +++ b/lib/modules/manager/gomod/update.spec.ts @@ -366,7 +366,7 @@ describe('modules/manager/gomod/update', () => { it('handles multiline replace update', () => { const fileContent = ` - go 1.18 + go 1.23 replace ( k8s.io/client-go => k8s.io/client-go v0.21.9 )`;