golang / gddo

Go Doc Dot Org
https://godoc.org
BSD 3-Clause "New" or "Revised" License
1.1k stars 267 forks source link

proposal: specify renamed imports in examples #647

Open gbbr opened 4 years ago

gbbr commented 4 years ago

Code example that use named import paths can render the code confusing because it is unclear to the reader which package the import refers to. Regardless of whether these are considered an anti-pattern or not, it's a valid use case and it would be helpful to cover for.

Example documentation with the problem: https://godoc.org/gopkg.in/DataDog/dd-trace-go.v1/contrib/gorilla/mux.

A possible solution would be:

Screenshot 2019-09-10 at 11 32 19

Where this would be shown only for named imports.