Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(gomod): use latest go version when binarySource=docker #9765

Merged
merged 3 commits into from May 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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`.