Skip to content

Commit

Permalink
fix(gomod): use latest go version when binarySource=docker (#9765)
Browse files Browse the repository at this point in the history
Co-authored-by: HonkingGoose <34918129+HonkingGoose@users.noreply.github.com>
Co-authored-by: Michael Kriese <michael.kriese@visualon.de>
  • Loading branch information
3 people committed May 1, 2021
1 parent 24201e1 commit bb2e7ff
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/manager/gomod/__snapshots__/extract.spec.ts.snap
Expand Up @@ -3,7 +3,7 @@
exports[`manager/gomod/extract extractPackageFile() extracts constraints 1`] = `
Object {
"constraints": Object {
"go": "1.13",
"go": "^1.13",
},
"deps": Array [
Object {
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/gomod/extract.spec.ts
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion lib/manager/gomod/extract.ts
Expand Up @@ -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
Expand Down
3 changes: 3 additions & 0 deletions lib/manager/gomod/readme.md
Expand Up @@ -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`.

0 comments on commit bb2e7ff

Please sign in to comment.