Skip to content
Snippets Groups Projects
Unverified Commit ce781fde authored by RahulGautamSingh's avatar RahulGautamSingh Committed by GitHub
Browse files

feat(manager/go): support modules without paths (#31155)

parent 7faeec70
No related branches found
No related tags found
No related merge requests found
......@@ -107,6 +107,28 @@ describe('modules/manager/gomod/line-parser', () => {
});
});
it('should parse go modules without paths - 1', () => {
const line = 'require tailscale.com v1.72.0';
const res = parseLine(line);
expect(res).toStrictEqual({
currentValue: 'v1.72.0',
datasource: 'go',
depName: 'tailscale.com',
depType: 'require',
});
});
it('should parse go modules without paths - 2', () => {
const line = 'require foo.tailscale.com v1.72.0';
const res = parseLine(line);
expect(res).toStrictEqual({
currentValue: 'v1.72.0',
datasource: 'go',
depName: 'foo.tailscale.com',
depType: 'require',
});
});
it('should parse require multi-line definition with quotes', () => {
const line = ' "foo/foo" v1.2';
const res = parseLine(line);
......
......@@ -10,7 +10,7 @@ function trimQuotes(str: string): string {
}
const requireRegex = regEx(
/^(?<keyword>require)?\s+(?<module>[^\s]+\/[^\s]+)\s+(?<version>[^\s]+)(?:\s*\/\/\s*(?<comment>[^\s]+)\s*)?$/,
/^(?<keyword>require)?\s+(?<module>[^\s]+\/?[^\s]+)\s+(?<version>[^\s]+)(?:\s*\/\/\s*(?<comment>[^\s]+)\s*)?$/,
);
const replaceRegex = regEx(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment