Skip to content
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/cmd/godoc: link from filename to source code #17125

Closed
gertcuykens opened this issue Sep 15, 2016 · 10 comments
Closed

x/tools/cmd/godoc: link from filename to source code #17125

gertcuykens opened this issue Sep 15, 2016 · 10 comments
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Milestone

Comments

@gertcuykens
Copy link
Contributor

gertcuykens commented Sep 15, 2016

Can for example src/net/http/client.go be made clickable so you can navigate more easily through the source code instead of changing the url in the urlbar manually?
image
godoc.org has a navigation menu and also links to the golang.org source code but once you are in the src file you have no navigation.

I am asking this because when you learn Go you end up easely in src files using the golang.org search field to look up golang stuff, for example https://golang.org/search?q=request

EDIT: One of the suggestions I can think of for the example https://golang.org/src/net/http/client.go

Source file src/net/http/client.go    Pakage name http <- https://golang.org/pkg/net/http/
- https://golang.org/src/net/http/
- https://golang.org/src/net/
- https://golang.org/src/

the left side we navigate the src files on the right side we have the general package link

@bradfitz
Copy link
Contributor

Sounds fine.

@bradfitz bradfitz changed the title proposal: Source file navigation and link to godoc x/tools/cmd/godoc: link from filename to source code Sep 15, 2016
@bradfitz bradfitz added this to the Go1.8Maybe milestone Sep 15, 2016
@gopherbot
Copy link

CL https://golang.org/cl/29279 mentions this issue.

@siadat
Copy link
Contributor

siadat commented Sep 16, 2016

The CL above (https://golang.org/cl/29279) makes net and http segments of

Source file src/net/http/client.go

clickable. E.g., if you click on the http segment you will be taken to the pkg/http page. Is this what we are looking for here?

@gertcuykens
Copy link
Contributor Author

gertcuykens commented Sep 16, 2016

@siadat what ever feels the most convenient. Take https://godoc.org/net/http navigation just as a example. The way to implement is open to any suggestions or methods.

src => https://golang.org/src/net/http/client.go
src => https://golang.org/src/net/http/
src => https://golang.org/src/net/
src => https://golang.org/src/
pkg => https://golang.org/pkg/net/http/

image

@gertcuykens
Copy link
Contributor Author

gertcuykens commented Sep 16, 2016

Let me know the navigation scheme below makes sense to everybody for the following page
https://golang.org/src/net/http/client.go

Source file src/net/http/client.go    Package name http <- https://golang.org/pkg/net/http/
- https://golang.org/src/net/http/
- https://golang.org/src/net/
- https://golang.org/src/

So on the left side we navigate the src files on the right side we have the general package link

@siadat
Copy link
Contributor

siadat commented Sep 16, 2016

Thanks @gertcuykens. I updated the CL.

Before

before-screenshot

After

after-screenshot

The source file segments are clickable. In the second screenshot I am hovering on http.

Regarding the look of it, I used <h2> subtitle for the link to documentation because it was already available in the HTML template.

@gertcuykens
Copy link
Contributor Author

gertcuykens commented Sep 16, 2016

Looks awesome! :D thanks, PS how can I test it ?

@siadat
Copy link
Contributor

siadat commented Sep 16, 2016

Get the go tools

go get golang.org/x/tools/...

Fetch and install the CL

cd $GOPATH/src/golang.org/x/tools
git fetch https://go.googlesource.com/tools refs/changes/79/29279/4 && git checkout FETCH_HEAD
go install ./...

Run it!

godoc -http=:6060

For any CL, the fetch command could be found in the Download menu of the CL in Gerrit.

@gertcuykens
Copy link
Contributor Author

gertcuykens commented Sep 17, 2016

@siadat nailed it! This is waaaaay better now to navigate trough source code and it even works wel on mobile too! Please put this in milestone Go1.8 instead of Go1.8Maybe

@siadat
Copy link
Contributor

siadat commented Sep 19, 2016

Latest screenshot (grey text for the last segment that is not a link, similar to godoc.org):
screenshot

@quentinmit quentinmit added the NeedsFix The path to resolution is known, but the work has not been done. label Oct 10, 2016
@rsc rsc modified the milestones: Go1.9, Go1.8Maybe Oct 21, 2016
@golang golang locked and limited conversation to collaborators Jun 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge help wanted NeedsFix The path to resolution is known, but the work has not been done.
Projects
None yet
Development

No branches or pull requests

6 participants