github.com/phsym/gomarkdoc@v0.5.4/testData/lang/function/func.go (about) 1 package function 2 3 // Standalone provides a function that is not part of a type. 4 // 5 // Additional description can be provided in subsequent paragraphs, including 6 // code blocks and headers 7 // 8 // Header A 9 // 10 // This section contains a code block. 11 // 12 // Code Block 13 // More of Code Block 14 func Standalone(p1 int, p2 string) (int, error) { 15 return p1, nil 16 } 17 18 // Receiver is a type used to demonstrate functions with receivers. 19 type Receiver struct{} 20 21 // New is an initializer for Receiver. 22 func New() Receiver { 23 return Receiver{} 24 } 25 26 // WithReceiver has a receiver. 27 func (r Receiver) WithReceiver() {} 28 29 // WithPtrReceiver has a pointer receiver. 30 func (r *Receiver) WithPtrReceiver() {} 31 32 // Generic is a struct with a generic type. 33 type Generic[T any] struct{} 34 35 // WithGenericReceiver has a receiver with a generic type. 36 func (r Generic[T]) WithGenericReceiver() {}