Renovate: Some go dependencies can't be resolved

Created on 5 Nov 2020  路  6Comments  路  Source: renovatebot/renovate

What Renovate type, platform and version are you using?
selfhosted, v23.72 in docker, accessing a Gitea instance.

Describe the bug
The go dependency fyne.io/fyne (and probably others) can not be resolved.

Relevant debug logs

DEBUG: Go lookup import url (repository=abc/xyz)                                                                                                                                                
       "goModule": "fyne.io/fyne",                                                                                                                                                                                   
       "goImportURL": "https://github.com/fyne-io/fyne"                                                                                                                                                              
DEBUG: GitHub 404 (repository=abc/xyz)                                                                                                                                                          
       "url": "https://github.com/api/v3/repos/fyne/undefined/tags?per_page=100"                                                                                                                                     
DEBUG: Datasource 404 (repository=abc/xyz)                                                                                                                                                      
       "datasource": "go",                                                                                                                                                                                           
       "lookupName": "fyne.io/fyne",                                                                                                                                                                                 
       "url": "https://github.com/api/v3/repos/fyne/undefined/tags?per_page=100"                                                                                                                                     
DEBUG: Failed to look up dependency fyne.io/fyne (repository=abc/xyz, packageFile=go.mod, dependency=fyne.io/fyne) 

To Reproduce
Here is a minimal reproduction repo: https://git.nroo.de/norwin/renovate-fyne-repro

Additional context
Note that the github fetch URL uses an incorrectly extracted repo slug (fyne/undefined instead of fyne-io/fyne).

Even if the repo slug was correct, this URL gives me a 404, shouldnt it be https://api.github.com/repos/...?

```
$ curl https://fyne.io/fyne/?go-get=1








The Fyne API - read the documentation.

go priority-3-normal reproduced bug

All 6 comments

Looks like a bad regex at gomod manger to me. 馃

Or go datasource issue.

@HonkingGoose can you please add go datasource label . 馃檭

Looking at the code, tracing backwards from https://github.com/renovatebot/renovate/blob/2932e88/lib/datasource/go/index.ts#L121, it seems that the issue is that the module lookupName is incorrectly sourced from the import name, not the repo URL:

https://github.com/renovatebot/renovate/blob/2932e88/lib/datasource/go/index.ts#L85-L86

The wrong github API URL might stem from an incorrectly generated registryUrl in https://github.com/renovatebot/renovate/blob/2932e88/lib/datasource/go/index.ts#L90 (missing :?)

I'd create a PR if I had the time, sorry..

here is going wrong:
https://github.com/renovatebot/renovate/blob/2932e8859870972937b8478907e3f8a55f549a9d/lib/datasource/go/index.ts#L84-L86

I think we need to add something like the following before:

    if (goImportURL?.startsWith('https://github.com/')) {
      return {
        datasource: github.id,
        depName: goModule,
        lookupName: goImportURL
          .replace('https://github.com/', '')
          .replace(/\/$/, ''),
      };
    }
    const gitlabRes = gitlabRegExp.exec(goImportURL);
    if (gitlabRes) {
      return {
        datasource: gitlab.id,
        depName: goModule,
        registryUrl: gitlabRes[1],
        lookupName: gitlabRes[2].replace(/\/$/, ''),
      };
    }

maybe we need to add an additional check for gitlab urls too?

@HonkingGoose can you please add go datasource label . :upside_down_face:

@viceice I don't have rights to create or delete labels. I can only apply labels that are already there.

I said:

I don't have rights to create or delete labels. I can only apply labels that are already there.

And @rarkins and @viceice responded with the "confused" emoji.

I found the relevant part in the GitHub Docs, Creating a label:

In repositories where you have write access, you can create labels to organize issues and pull requests.

It's a bit strange that somebody who is given "triage" level rights cannot create/edit/remove labels. I don't want write level rights here, I like having my stuff reviewed before it gets in the mainline branch. :smile:

It's also strange that the ability to create/edit labels is not defined per access level in the big table of things you can do per level at GitHub docs, repository permission levels for an organization.

I have not found a way in the docs for you to only give the additional right to create/edit/remove labels. It seems you can only choose between the "predefined" roles, instead of picking and choosing permissions from a large list.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

OmgImAlexis picture OmgImAlexis  路  4Comments

kogai picture kogai  路  3Comments

ChristianMurphy picture ChristianMurphy  路  4Comments

zephraph picture zephraph  路  3Comments

rarkins picture rarkins  路  3Comments