I’m working on getting some metadata about Golang packages and the package itself
I’ve seen that for some packages Golang proxy doesn’t provide the data for example:
and same url with suffix .zip instead of .info
The endpoint is stating: bad request: invalid escaped version “v0.1.0-M3”
But I can see such tag is avilable on GitHub:
Release v0.1.0-M3 · eclipse-kanto/suite-connector · GitHub
Can you please help on how to solve this issue or suggest any other way to reach my goal ?
Thank you guys !
Hi @ozblumen, welcome to the forum.
It seems as if the pre-release qualifier has to follow a specific schema (even though this is not documented). When I try to access a (non-existing) “beta.1” pre-release…
…the error message is different from yours:
not found: firstname.lastname@example.org: invalid version: unknown revision v0.1.0-beta.1
(This error is valid because no
I played around with several variants and discovered that the pre-release identifier must not contain uppercase characters. (For example,
alphA trigger the “invalid escaped version” error, while
alpha works fine and triggers the expected “not found” error.)
I don’t know if this is a bug or by design.
It’s even a violation of the spec for semver, though they are not specific which version to follow, perhaps an earlier version was more restrictive.
A released module is published with a version number in the semantic versioning model,
Semver allows arbitrary alphanumeric labels without specifying a certain casing.
See Semantic Versioning 2.0.0 | Semantic Versioning
Good point, @NobbZ. It would then sound like a bug to me. A quick search through the issues of GitHub - golang/go: The Go programming language did not reveal anything related, however.
@christophberger & @NobbZ thanks for your comments so much !
Well I found the issue in order to know the exact URL for the info endpoint, you can run the following command: go mod download. -json <package_name>@<package_version>
And you are going to get a set of urls regarding package metadata.
So for the above case upper case letters should transform into <uppercase_letter> → !<downcase_letter>
You can also find the specs here: https://github.com/golang/go/blob/c54bc3448390d4ae4495d6d2c03c9dd4111b08f1/src/cmd/go/internal/module/module.go#L359-L417
Let me know if it works for you,
@ozblumen That’s interesting, thanks for the pointer!
So your initial URL only needs this transformation : M → !m
…and I get a valid response back.
It’s interesting to see how the pre-release identifier transformation impacts the URL and resolves the issue.