Cite snippets in your godoc
go install github.com/mmcloughlin/cite/cmd/cite
To reference something, add an insert line into your godoc
.
package example
import "fmt"
// Greet says hello to who.
//
// Insert: https://github.com/mmcloughlin/cite/blob/master/example/grinch.txt#L6-L8
func Greet(who string) {
fmt.Printf("Hello, %s!\n", who)
}
Then run
$ cite process example.go
It will fetch the reference and insert it into your code.
package example
import "fmt"
// Greet says hello to who.
//
// Reference: https://github.com/mmcloughlin/cite/blob/master/example/grinch.txt#L6-L8
//
// Every Who Down in Whoville Liked Christmas a lot...
// But the Grinch,Who lived just north of Whoville, Did NOT!
// The Grinch hated Christmas! The whole Christmas season!
//
func Greet(who string) {
fmt.Printf("Hello, %s!\n", who)
}
It should look nice in your godoc.