6

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.

tuk
  • 5,941
  • 14
  • 79
  • 162
  • 1
    Easiest examples is to look at Go's actual documentation on https://golang.org/pkg/ and browse around until you find it. Then click on the source file and look at the actual comments. – eduncan911 Sep 24 '16 at 11:27

2 Answers2

4

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.

xh3b4sd
  • 865
  • 8
  • 17
1

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 {
Jonathan Hall
  • 75,165
  • 16
  • 143
  • 189