Skip to content

go/doc: example including go- prefixed packages not considered as playable #56740

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

Open
yoanm opened this issue Nov 15, 2022 · 1 comment · May be fixed by #56746
Open

go/doc: example including go- prefixed packages not considered as playable #56740

yoanm opened this issue Nov 15, 2022 · 1 comment · May be fixed by #56746
Labels
FixPending Issues that have a fix which has not yet been reviewed or submitted. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Milestone

Comments

@yoanm
Copy link

yoanm commented Nov 15, 2022

What version of Go are you using (go version)?

go 1.19

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

Playground env

What did you do?

See https://go.dev/play/p/SPW5ePcwU2Y

What did you expect to see?

The three examples should be playable

What did you see instead?

Example including go- prefixed packages not rendered as playable example, unless use of totally useless explicit alias

  • First example for mypkg is playable
  • Second example for go-mypkg is not playable
  • But third example for go-mypkg using mypkg alias is playable

Additional information

Issue might come from there, as import path contains go- prefix, it doesn't match the package name at runtime (where go- prefix is automatically removed), therefore related package is considered as unresolved, which leads to the whole example not considered playable.

One solution might be to trim go- prefix before that line

@gopherbot gopherbot added the Tools This label describes issues relating to any tools in the x/tools repository. label Nov 15, 2022
@gopherbot gopherbot added this to the Unreleased milestone Nov 15, 2022
yoanm added a commit to yoanm/go that referenced this issue Nov 15, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
yoanm added a commit to yoanm/go that referenced this issue Nov 15, 2022
Trim go- prefix from package name (like it's done on runtime) before looking for related unresolved package.

Fixes golang#56740
@gopherbot
Copy link
Contributor

Change https://go.dev/cl/450855 mentions this issue: go/doc: fix example generation for package prefixed with go-

@joedian joedian added the NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. label Nov 16, 2022
@dmitshur dmitshur removed their assignment Sep 7, 2023
@dmitshur dmitshur added NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. and removed NeedsDecision Feedback is required from experts, contributors, and/or the community before a change can be made. Tools This label describes issues relating to any tools in the x/tools repository. labels Sep 7, 2023
@dmitshur dmitshur changed the title x/tools/godoc,gddo: Example including go- prefixed packages not rendered as playable go/doc: example including go- prefixed packages not considered as playable Sep 7, 2023
@dmitshur dmitshur modified the milestones: Unreleased, Backlog Sep 7, 2023
@dmitshur dmitshur added the FixPending Issues that have a fix which has not yet been reviewed or submitted. label Apr 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
FixPending Issues that have a fix which has not yet been reviewed or submitted. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants