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

Golang support #113

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

CsatariGergely
Copy link

A very basic implementation for golang support. Supports most of the golang purls what I tested with, but not perfect.

Signed-off-by: Gergely Csatari <gergely.csatari@nokia.com>
Signed-off-by: Gergely Csatari <gergely.csatari@nokia.com>
# https://stackoverflow.com/questions/57355929/what-does-incompatible-in-go-mod-mean-will-it-cause-harm
if "-" in purl_data.version:
version = purl_data.version.split("-")
if exp.match(purl_data.name):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the point of this check? Do go package names sometimes have v[0-9]+ in them? Why do we use the name in the download_url in that case?

Copy link

@jasinner jasinner Feb 21, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe this check should actually be:
if len(namespace) >= 3:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, perhaps this check is looking for modules with backward incompatiable changes as explained here: https://go.dev/doc/modules/release-workflow

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe the checks could instead be replaced by:

                if len(namespace_parts) == 2:
                    return (
                        f"https://{namespace_parts[0]}/{namespace_parts[1]}/{purl_data.name}"
                        f"/tree/{version}"
                    )
                else:
                    return (
                        f"https://{namespace_parts[0]}/{namespace_parts[1]}/{namespace_parts[2]}"
                        f"/tree/{version}"
                    )

I don't see the need for the regular expression check because the backwards incompatiable changes always occur at the 3rd portion of the namespace anyway right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants