diff --git a/lib/datasource/go.js b/lib/datasource/go.js index 1355c791ed1f6d05f46672ab5cbe046b48a44d2c..78aa8ae4b4616d149f59302163e62254838a5c66 100644 --- a/lib/datasource/go.js +++ b/lib/datasource/go.js @@ -73,6 +73,11 @@ async function getPkgReleases(purl, config) { const githubPurl = await getSourcePurl(name); if (githubPurl) { const githubTags = await github.getPkgReleases(githubPurl, config); + if (githubTags.releases) { + githubTags.releases = githubTags.releases.filter( + release => release.version && release.version.startsWith('v') + ); + } return githubTags; } return null; diff --git a/test/datasource/__snapshots__/go.spec.js.snap b/test/datasource/__snapshots__/go.spec.js.snap index 603e65b9d7888711bbb303250af9f15a4d10dc20..a1b210dc4dad77f2fc775de79b0ed82e0dba0690 100644 --- a/test/datasource/__snapshots__/go.spec.js.snap +++ b/test/datasource/__snapshots__/go.spec.js.snap @@ -3,8 +3,12 @@ exports[`datasource/go getPkgReleases processes real data 1`] = ` Object { "releases": Array [ - 1, - 2, + Object { + "version": "v1.0.0", + }, + Object { + "version": "v2.0.0", + }, ], } `; diff --git a/test/datasource/go.spec.js b/test/datasource/go.spec.js index 17137d9b26cea1bd4ab561657352f77f929c4b99..b711a4b9dacbb660e12116be86cee3b8f2cbe6c7 100644 --- a/test/datasource/go.spec.js +++ b/test/datasource/go.spec.js @@ -67,7 +67,9 @@ describe('datasource/go', () => { got.mockReturnValueOnce({ body: res1, }); - github.getPkgReleases.mockReturnValueOnce({ releases: [1, 2] }); + github.getPkgReleases.mockReturnValueOnce({ + releases: [{ version: 'v1.0.0' }, { version: 'v2.0.0' }], + }); const res = await datasource.getPkgReleases('pkg:go/golang.org/x/text'); expect(res).toMatchSnapshot(); expect(res).not.toBeNull();