Skip to content

x/pkgsite: example code should be displayed as package main when rendering #37291

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
fishy opened this issue Feb 19, 2020 · 3 comments
Closed
Labels
FrozenDueToAge help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite

Comments

@fishy
Copy link

fishy commented Feb 19, 2020

What is the URL of the page with the issue?

https://pkg.go.dev/github.com/reddit/baseplate.go@v0.0.0-20200327042237-1365288992e4/thriftclient?tab=doc#example-package

What did you expect to see?

On godoc.org, the Example* functions will be renamed to main when rendering, for example: https://godoc.org/github.com/reddit/baseplate.go/thriftclient#example-package

What did you see instead?

On pkg.go.dev we kept the original Example function name in the code.

@gopherbot gopherbot added this to the Unreleased milestone Feb 19, 2020
@toothrot toothrot added the NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. label Feb 19, 2020
@toothrot
Copy link
Contributor

/cc @julieqiu

@julieqiu
Copy link
Member

Thanks for reporting the bug, @fishy! We'll look into it.

/cc @dmitshur

@julieqiu julieqiu changed the title go.dev: Example functions are not renamed to main when rendering go.dev: example code should be displayed as package main when rendering Feb 19, 2020
@julieqiu julieqiu changed the title go.dev: example code should be displayed as package main when rendering x/pkgsite: example code should be displayed as package main when rendering Jun 15, 2020
@AceroM
Copy link

AceroM commented Aug 20, 2020

This issue was fixed in https://golang.org/cl/240685, and will be available soon on pkg.go.dev. It is currently behind the executable-examples experiment flag.

If you would like to test it out locally, you can run go run ./devtools/cmd/experiment create executable-examples.

The output should look like this:
image

@AceroM AceroM closed this as completed Aug 20, 2020
@golang golang locked and limited conversation to collaborators Aug 20, 2021
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
FrozenDueToAge help wanted NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. pkgsite
Projects
None yet
Development

No branches or pull requests

5 participants