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

Support GoPkg.in Semantics #726

Closed
naturalwarren opened this issue Mar 9, 2020 · 1 comment
Closed

Support GoPkg.in Semantics #726

naturalwarren opened this issue Mar 9, 2020 · 1 comment

Comments

@naturalwarren
Copy link

Versions

gazelle: 0.20.0
rules_go: 0.22.1
bazel: 2.1.1
OS: Mac OS Catalina
Processor Architecture: x86

Running the versions specified in the README.md.

What did you do?

I have a go.mod file that includes the line require gopkg.in/yaml.v3 v3. At the time of writing this ticket, this repository has not created a v3 tag, only a branch.

When attempting to use Gazelle to generate BUILD files for this project it exits with code 1.

What did you see?

go: errors parsing go.mod:
/private/var/folders/8s/gn_6097n1kgbrv19qs29fr8m0000gn/T/gazelle-temp-gomod578605918/go.mod:4: no matching versions for query "v3"
gazelle: exit status 1

Per the GoPkg.in semantics a version can point to either a branch or a tag. Gazelle however only supports tags. Can Gazelle support branches in addition to tags to satisfy the gopkg.in spec? Branch and tag refs must be unique within a repository.

@jayconrod
Copy link
Contributor

Sorry, Gazelle will only follow Go module semantics when importing go.mod files, nothing additional on top of that.

go.mod files may temporarily refer to versions using version queries (anything that goes after @ in go get, like latest or master). Any command that loads the module graph will attempt to resolve these to canonical version. Gazelle runs go list -m -json all, so that's what's failing.

v3 in this case is being interpreted as a version prefix rather than a tag or branch. It matches the highest version from the list returned by go list -m -versions gopkg.in/yaml.v3 that starts with v3. That list is empty, so an error is reported. This behavior is a bit surprising, and I think we should change it, but that's another issue (golang/go#29731).

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

No branches or pull requests

2 participants