godoc link#24
Conversation
This will also, add the links to public documentation
|
Did you have a chance to review? |
|
I’ll try to review this weekend |
|
Could you please give me an example how it affect the documentation. With and without this change. |
|
Sure
You can think about more complex link, even in the current package. For example, in your package you can add something like More information here |
|
About the rendering Take a look here https://cs.opensource.google/go/go/+/refs/tags/go1.23.4:src/encoding/json/encode.go;l=36 You will see the godoc links in the godoc of Marshal And here you can see the rendering Everything I underlined in yellow are the rendered godoc links |
|
I see the problem, agree, this feature is needed but not sure in the implementation. Need some time to rethink. |
|
Gentle nudge @chocolacula |
|
Sorry for the long absence, it's been a while since I checked this, I might be wrong somewhere but in general there are 2 problems:
The last point is easy to check with basic So if we cannot make it working 100% it's better to do nothing and keep it as text. |
|
Thanks for your feedbacks. While I get your points, I'm unsure it works the way you mention. I will have to double check, but from what I remember. The idea of the PR is not to add links wherever possible. The idea is to render links in the same way pkgsite would render them locally, so the way pkg.go.dev would render them. So if someone use json.Marshaler and json package is not imported or json refers to something else than the std one. It won't work on pkg.go.dev or with pkgsite locally. Then I don't expect magic to happen on your tool then. It's worth checking again. I will on my side for now. But for now, while I appreciate the feedbacks, it doesn't seem related to the code I provided, but about the possible traps that exists when working with go doc links. |
|
I should admit I didn't explain it well, but let me point to the same example as you mentioned above. It doesn't work 100% even in If no [Marshaler.MarshalJSON] method is present but the value implements [encoding.TextMarshaler](https://pkg.go.dev/encoding#TextMarshaler) instead, Marshal calls [encoding.TextMarshaler.MarshalText](https://pkg.go.dev/encoding#TextMarshaler.MarshalText) and encodes the result as a JSON string.
And it's not clear for me how to handle private repos and different doc sources like |
|
Thanks for your explanation, it's clearer. I agree gopls (that your IDE is using) might have a feature to make it works. While the code used by pkg.go.dev, and so pkgsite, doesn't. I think the lib I used for the implementation in this PR, is the exact one used by pkgsite. I'll look for an open issue about it. I'll have to double check, but I don't feel like it's an issue in godmd with the current implementation I made. I agree private repository might be a real issue to tackle separely, or simply never. |


Fixes #17