-
Notifications
You must be signed in to change notification settings - Fork 18k
usability: Parsing binary information from names on golang.org/dl is difficult #20892
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
Comments
When all else fails, regexp will save us all, mark my words! |
Is this about getting JSON out of golang.org/x/tools/godoc/dl/dl.go? |
I'm not sure - @weingart was the initial requester. |
Timed out in state WaitingForInfo. Closing. (I am just a bot, though. Please speak up if this is a mistake or you have the requested information.) |
This seems rather relevant to the one-line install discussion. Re-opening to give @spf13 a chance to weigh in. |
Thanks, @gopherbot, but I want this open. |
Hmm, @gopherbot shouldn't be fighting you. Most of the gopherbot tasks try hard to not re-do actions if it looks like somebody did the opposite. Maybe that task has a bug? |
Didn't realize that I was paged here. I was attempting to write a fairly simple download/install thing that could be used to "track" stable/beta/rc style candidates. While working on this, I also noticed that a new binary with a name/key of "getgo/installer_*" appeared... however, at the time I checked, the source for this was not available (looks to be part of a private github repo). I was optimistic that it would do what I wished... however, even the "dry_run" feature ended up splatting things all over my home directory/etc. Documenting the filename format, possibly renaming a few of the files to be more consistent, or even publishing a go package that parses the filename format or gives you a way to list based on some parameters and get the URL for a download, would be awesome. |
There's likely easier ways to do this, but this is what I ended up with, which seems sub-optimal. Various regexes may improve the verbosity and/or readability. I've not explored that direction much yet. https://gist.github.com/weingart/7567dcee16796e7242356f3547a7d5b5 |
@weingart - We have https://golang.org/dl/?mode=json which returns json that you can parse. On top of it, this CL adds support for returning Archive and Unstable downloads too. I guess that should suffice your requirements. Please let us know if you need anything else. |
From the Gophers Slack channel, someone is attempting to parse the filenames here: https://storage.googleapis.com/golang into their component parts.
Examples:
Parsing these is a little less than trivial:
The version string may have one or two periods, and may include the words "beta" or "rc"
The machine may have two parts ("freebsd-386") or three ("darwin-amd64-osx10.8").
Multiple different possible endings - pkg, tar.gz, msi, zip.
It might be good to write a canonical version-string parser, or point people to an easier-to-parse information source, if one exists.
The text was updated successfully, but these errors were encountered: