tuk
tuk

Reputation: 6872

Refer a different package from the godoc of a package

Can someone let me know if it is possible to refer a different package from godoc of a package? For example let's say I have a package src/logger/. In src/logger/doc.go I need to refer src/config/. Something like @see in javadoc.

Is there a recommended way?

I am on Go 1.7.

Upvotes: 6

Views: 4591

Answers (2)

Jonathan Hall
Jonathan Hall

Reputation: 79674

As of Go 1.19's enhancements to GoDoc, this is now possible with documentation links.

// Foo returns a [os.File].
func Foo() *os.File {

Upvotes: 1

xh3b4sd
xh3b4sd

Reputation: 873

I am not aware that this is currently possible. E.g. https://golang.org/pkg/io/ioutil/#TempFile refers to the os package simply using *os.File. See the source code comments at https://golang.org/src/io/ioutil/tempfile.go#L40.

and writing, and returns the resulting *os.File.

Upvotes: 4

Related Questions