These instructions on go.dev/about for adding a package to the docs are not actionable:
To add a package or module, simply fetch it from proxy.golang.org.
I don't know what "fetch it from proxy.golang.org" means or how to go about doing that. I'm sure I'm not the only one.
Also, avoid putting "simply" or "just" in directions, because they trivialize a step which may actually not be trivial for the person attempting it. Like, me, trying to figure out how to fetch something from a go proxy. Remove the word and it reads exactly the same, except if I don't know how to do it, I don't feel like I've been talked down to.
/cc @julieqiu
I just ran into the same issue. After a little googling, my best guess about how to "simply fetch it from proxy.golang.org" is:
GO111MODULE=on go get {package}@latest
I don't know whether that's accurate or not. Whatever the solution, I agree @natefinch it should just be spelled out at https://go.dev/about#adding-a-package
The best confirmation of the fact that this step is really not obvious is that I had the same question and, by googling, I ended up here. So +1 to the issue.
+1 for improving the instructions. I ran the command which I understand from the instructions and this issue:
$ GOPROXY=https://proxy.golang.org GO111MODULE=on go get github.com/posener/compare@latest
go: github.com/posener/compare latest => v0.0.1
But it stil does not appear in go.dev: https://pkg.go.dev/search?q=posener%2Fcompare says "No results found".
OK, it took it a couple of minutes. I suggest adding in the instructions that the update is not immediate.
Agreed - we are working with the broader go.dev team to update the about section, and add more detailed instructions with examples to the about page.
We are also working on supporting #37106. In the meantime, if you don鈥檛 see a package on pkg.go.dev, you can add it by:
Making a request to proxy.golang.org for the module version
https://proxy.golang.org/<module>/@latesthttps://proxy.golang.org/<module>/@v/<version>.infoDownloading the package via the go command
$ GOPROXY=https://proxy.golang.org GO111MODULE=on go get <package>/cc @pearring @spf13 @fflewddur
Any reason that is not being added automatically? I mean, instead of showing the not found page, why wouldn't the server make the above calls and update itself?
@posener, I assume it's done like that in order to prevent DoS-like misuse: if one would constantly issue requests to non-existing packages, then the server would need to issue a lot of "update" attempts in its turn which may lead to some bad consequences.
There are solutions for that, such as rate limiting the internal calls to update the index.
https://go.dev/about has been updated.
We plan to make this experience better by supporting #37106 and #37002 in the future.
@julieqiu
There is a type in the instructions: (redundant/missing double-quotes) in GOPROXY=鈥渉ttps://proxy.golang.org GO111MODULE=on go get example.com/my/[email protected]
Also - I think it is better to replace @v1.0.0 with @latest.
Also - for the first way of adding the entry: https://proxy.golang.org/example.com/my/module/@v/v1.0.0.info, it is not clear that it should be curled, and when trying it with my own repo I get 404 - is it expected when the repo is not yet in pkg.go.dev?
Also - what about my proposal that go.dev will do it for the developer? I still don't understand why the developer needs to manually add it (see https://github.com/golang/go/issues/37005#issuecomment-599719926).
Thanks!
@posener - thanks for catching the typo and for the suggestion. We will fix it and add additional instructions for downloading the latest version of a module.
Also - for the first way of adding the entry: https://proxy.golang.org/example.com/my/module/@v/v1.0.0.info, it is not clear that it should be curled, and when trying it with my own repo I get 404 - is it expected when the repo is not yet in pkg.go.dev?
What repo are you trying to fetch and what URL did you visit?
Also - what about my proposal that go.dev will do it for the developer? I still don't understand why the developer needs to manually add it (see #37005 (comment)).
I mentioned in https://github.com/golang/go/issues/37005#issuecomment-604650209 that we are planning to support #37106 and #37002. Is your proposal different from #37002? If so, could you please file a new issue?
Great,
Until they those issues are addressed, I think that the current instructions are still not good enough. What does "making a request" mean - how to do it, and what to expect in the returned response.
Thanks!
Most helpful comment
Agreed - we are working with the broader go.dev team to update the about section, and add more detailed instructions with examples to the about page.
We are also working on supporting #37106. In the meantime, if you don鈥檛 see a package on pkg.go.dev, you can add it by:
Making a request to proxy.golang.org for the module version
https://proxy.golang.org/<module>/@latesthttps://proxy.golang.org/<module>/@v/<version>.infoDownloading the package via the go command
$ GOPROXY=https://proxy.golang.org GO111MODULE=on go get <package>/cc @pearring @spf13 @fflewddur