go icon indicating copy to clipboard operation
go copied to clipboard

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

Open yoanm opened this issue 3 years ago • 2 comments

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

yoanm avatar Nov 15 '22 08:11 yoanm