Quantcast
Channel: User Jonathan - Stack Overflow
Viewing all articles
Browse latest Browse all 40

Best way to link to another package in doc.go files

$
0
0

What's the best way to link to a doc in another package when writing package docs in a doc.go file? Unfortunately, the normal approach of referencing an imported package doesn't work in doc.go files since unused imports aren't allowed.

// Package foo docs in a doc.go file// foo uses [bar.Bar] types for doing things.package fooimport "foo.com/jonathan/godoctest/bar" // Unused import error here

Using a fully qualified path does work, but doesn't make for the most readable docs:

// Package foo docs in a doc.go file// foo uses [foo.com/jonathan/godoctest/bar.Bar] types for doing things.package foo

Any ideas for a workaround?


Viewing all articles
Browse latest Browse all 40

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>