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

Inline part of the full examples #440

Open
3052 opened this issue Mar 5, 2024 · 7 comments
Open

Inline part of the full examples #440

3052 opened this issue Mar 5, 2024 · 7 comments
Labels
Milestone

Comments

@3052
Copy link

3052 commented Mar 5, 2024

https://godocs.io/nhooyr.io/websocket#example-package-Echo
https://godocs.io/nhooyr.io/websocket#example-package-FullStackChat

@nhooyr
Copy link
Contributor

nhooyr commented Mar 6, 2024

If you follow the link comment you'll see the example.

If not please let me know. Worked for me just tried it.

@nhooyr nhooyr closed this as completed Mar 6, 2024
@3052
Copy link
Author

3052 commented Mar 6, 2024

I code Go both professionally and personally, and this is the first time I have ever seen an example like this:

package main

import ()

func main() {
	// https://github.com/nhooyr/websocket/tree/master/internal/examples/echo
}

why not just code the examples inline, like the rest:
https://godocs.io/nhooyr.io/websocket#example-package-CrossOrigin

@nhooyr
Copy link
Contributor

nhooyr commented Mar 6, 2024

It's a multi file example with tests. Such examples cannot be effectively included inline with godoc. At least not to my knowledge.

@nhooyr
Copy link
Contributor

nhooyr commented Mar 6, 2024

Perhaps it would be worth having the echo.go file inline though and also link to the full runnable example.

@nhooyr nhooyr reopened this Mar 6, 2024
@nhooyr nhooyr added the docs label Mar 6, 2024
@nhooyr nhooyr changed the title empty example Inline part of the full examples Mar 6, 2024
@nhooyr nhooyr added this to the v1.9.0 milestone Mar 6, 2024
@3052
Copy link
Author

3052 commented Mar 6, 2024

I mean if you are getting to the point where you examples are multiple files, it might be better to just link to the GitHub folder where the example are. but just do a normal link to the folder, putting a link inside a Go program just seems wrong.

@nhooyr
Copy link
Contributor

nhooyr commented Mar 6, 2024

I mean if you are getting to the point where you examples are multiple files, it might be better to just link to the GitHub folder where the example are. but just do a normal link to the folder, putting a link inside a Go program just seems wrong.

Problem is such links are not easily identifiable unless you read the full godoc which many people do not do. This way, it's easily identifiable as part of the godoc UI.

@3052
Copy link
Author

3052 commented Mar 6, 2024

OK, well put the link/links the VERY top of the doc, that way its unlikely to be missed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants