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

Some go dependencies can't be resolved #7663

Closed
noerw opened this issue Nov 5, 2020 · 7 comments · Fixed by #9022
Closed

Some go dependencies can't be resolved #7663

noerw opened this issue Nov 5, 2020 · 7 comments · Fixed by #9022
Assignees
Labels
datasource:go priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality

Comments

@noerw
Copy link

noerw commented Nov 5, 2020

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
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
        <meta name="go-import" content="fyne.io/fyne git https://github.com/fyne-io/fyne">
        <meta http-equiv="refresh" content="0; url=https://github.com/fyne-io/fyne">
    </head>
    <body>
        The Fyne API - read the <a href="http://godoc.org/fyne.io/fyne">documentation</a>.
    </body>
</html>
@viceice viceice added manager:gomod Go Modules type:bug Bug fix of existing functionality priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others labels Nov 5, 2020
@viceice
Copy link
Member

viceice commented Nov 5, 2020

Looks like a bad regex at gomod manger to me. 🤔

@viceice
Copy link
Member

viceice commented Nov 5, 2020

Or go datasource issue.

@HonkingGoose can you please add go datasource label . 🙃

@noerw
Copy link
Author

noerw commented Nov 6, 2020

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..

@viceice viceice added datasource:go and removed manager:gomod Go Modules labels Nov 6, 2020
@viceice
Copy link
Member

viceice commented Nov 6, 2020

here is going wrong:

// split the go module from the URL: host/go/module -> go/module
const split = goModule.split('/');
const lookupName = split[1] + '/' + split[2];

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

This comment has been minimized.

@HonkingGoose

This comment has been minimized.

@renovate-release
Copy link
Collaborator

🎉 This issue has been resolved in version 24.77.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
datasource:go priority-3-medium Default priority, "should be done" but isn't prioritised ahead of others type:bug Bug fix of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants