-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/tools/gopls: respect GOPRIVATE setting when linking to pkg.go.dev (hover, documentLink) #36998
Comments
Just want mention a different use case: organizations that run their internal doc servers would want the linkTarget to point to their doc servers. OTOH, I expect they can easily set up private proxies to avoid depending on GOPRIVATE. |
Change https://golang.org/cl/233524 mentions this issue: |
There's actually one more case where this needs to be handled - https://pkg.go.dev links get generated for import statements through the |
Currently, our hover text by default links point to public documentation sites (e.g. pkg.go.dev). This doesn't make sense for private repos, so hide the hovertext link when the import path matches GOPRIVATE. Implementing this was a little messy. To be optimal I had to thread the value of goprivate through cache.view, and to be correct I had to duplicate some code from cmd/go internal. Regtest will follow after https://golang.org/cl/232983 is submitted. Updates golang/go#36998 Change-Id: I1e556471bf919fea30132d9642426a08fdb7f434 Reviewed-on: https://go-review.googlesource.com/c/tools/+/233524 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
I think this is fixed? |
Let's rename the issue to cover the document link case as well. |
Yeah, I will get to the documentLink eventually. Can leave this assigned to me. |
Change https://golang.org/cl/237938 mentions this issue: |
Change https://golang.org/cl/238029 mentions this issue: |
Add a regtest to verify that GOPRIVATE identifiers are not given a link to pkg.go.dev. For efficiency, as well as to exercise dynamic configuration, do all this in a single regtest. Updates golang/go#36998 Change-Id: I9102a11312db5c334fdbd30cce9ca2d2e19e9ac2 Reviewed-on: https://go-review.googlesource.com/c/tools/+/237938 Run-TryBot: Robert Findley <rfindley@google.com> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Rebecca Stambler <rstambler@golang.org>
Is it an additional bug that all this pkg.go.dev hover and link activity is still going on even when |
@sandipb: yes, GOPRIVATE relates to proxy behavior when using modules. This bug is about hiding links to package documentation when paths match GOPRIVATE. If paths are private, it's likely that those links will be broken anyway. But as you say, that only applies to module mode. Are you saying that if GO111MODULE=off, we shouldn't link to package documentation? Or are you saying if GO111MODULE=off we shouldn't check GOPRIVATE? There may be a bug, I'm not sure I understand your question. |
Hi @findleyr sorry for the delay in the response. I meant, if |
Hi @sandipb -- both godoc.org and pkg.go.dev host package documentation. They are not proxies. Unlike godoc.org, pkg.go.dev is "module-aware", so you can see package documentation for older module versions. In GOPATH mode, it still seems reasonable to link to package documentation for the package import path. In any case, if I recall correctly we link to the latest version of documentation, so whether using modules or not the linked package documentation might be for a newer version than what you are importing. |
Agree with everything @findleyr said here, but wanted to add a quick point of clarification on the last statement:
We do link to the correct version of the docs (code here), so if you are using modules, you will get the correct versions. However, as @findleyr said, even if you are not using modules, these documentation links to https://pkg.go.dev are still useful. |
Ack. Thanks, folks, for the clarification. |
Reported on Slack. We shouldn't over links to packages covered by
GOPRIVATE
.The text was updated successfully, but these errors were encountered: