diff --git a/lib/manager/gomod/__snapshots__/extract.spec.ts.snap b/lib/manager/gomod/__snapshots__/extract.spec.ts.snap index a553b66ece19b2..24e3d87ab8df1f 100644 --- a/lib/manager/gomod/__snapshots__/extract.spec.ts.snap +++ b/lib/manager/gomod/__snapshots__/extract.spec.ts.snap @@ -3,7 +3,7 @@ exports[`manager/gomod/extract extractPackageFile() extracts constraints 1`] = ` Object { "constraints": Object { - "go": "1.13", + "go": "^1.13", }, "deps": Array [ Object { diff --git a/lib/manager/gomod/extract.spec.ts b/lib/manager/gomod/extract.spec.ts index d90cda8f521529..1de4a0479ae1e4 100644 --- a/lib/manager/gomod/extract.spec.ts +++ b/lib/manager/gomod/extract.spec.ts @@ -20,7 +20,7 @@ describe(getName(), () => { it('extracts constraints', () => { const res = extractPackageFile(gomod3); expect(res).toMatchSnapshot(); - expect(res.constraints.go).toEqual('1.13'); + expect(res.constraints.go).toEqual('^1.13'); }); it('extracts multi-line requires', () => { const res = extractPackageFile(gomod2).deps; diff --git a/lib/manager/gomod/extract.ts b/lib/manager/gomod/extract.ts index 8bc055941ce992..d5146e28bf2b88 100644 --- a/lib/manager/gomod/extract.ts +++ b/lib/manager/gomod/extract.ts @@ -43,7 +43,7 @@ export function extractPackageFile(content: string): PackageFile | null { for (let lineNumber = 0; lineNumber < lines.length; lineNumber += 1) { let line = lines[lineNumber]; if (line.startsWith('go ') && validRange(line.replace('go ', ''))) { - constraints.go = line.replace('go ', ''); + constraints.go = line.replace('go ', '^'); } const replaceMatch = /^replace\s+[^\s]+[\s]+[=][>]\s+([^\s]+)\s+([^\s]+)/.exec( line diff --git a/lib/manager/gomod/readme.md b/lib/manager/gomod/readme.md index 3df99e90e530d6..ba2ae2ee413262 100644 --- a/lib/manager/gomod/readme.md +++ b/lib/manager/gomod/readme.md @@ -3,3 +3,6 @@ You might be interested in the following `postUpdateOptions`: 1. `gomodTidy` - if you'd like Renovate to run `go mod tidy` after every update before raising the PR. 1. This is implicitly enabled for major updates 1. `gomodUpdateImportPaths` - if you'd like Renovate to update your source import paths on major updates before raising the PR. + +When Renovate is running using `binarySource=docker` (such as in the hosted WhiteSource Renovate app) then it will pick the latest compatible version of Go to run, i.e. the latest `1.x` release. +Therefore even if the `go.mod` contains a version like `go 1.14`, you will see Renovate treating that as a `^1.14` constraint and not `=1.14`.