| 1 | // package a docs |
| 2 | // lorem ipsum dolor... |
| 3 | package a |
| 4 | |
| 5 | import "time" |
| 6 | |
| 7 | // ------------------------------------------------------------------- |
| 8 | // variables (note: currently are ignored) |
| 9 | // ------------------------------------------------------------------- |
| 10 | |
| 11 | var unexportedVar int = 123 |
| 12 | |
| 13 | // comment |
| 14 | var VarA = 123 // after |
| 15 | |
| 16 | var VarB any = "test" |
| 17 | |
| 18 | // external package type |
| 19 | var VarC time.Time = time.Now() |
| 20 | |
| 21 | // chan |
| 22 | var VarD = make(chan int) |
| 23 | |
| 24 | // composite |
| 25 | var VarE = map[string]func(){"test": func() {}} |
| 26 | |
| 27 | // ------------------------------------------------------------------- |
| 28 | // constants |
| 29 | // ------------------------------------------------------------------- |
| 30 | |
| 31 | const unexportedConst = "123" |
| 32 | |
| 33 | // comment |
| 34 | const ConstA string = "test" // after |
| 35 | |
| 36 | // multi |
| 37 | // line |
| 38 | // comment |
| 39 | const ConstB = 123 |
| 40 | |
| 41 | // some generic group comment |
| 42 | const ( |
| 43 | ConstC0 = iota |
| 44 | ConstC1 // after |
| 45 | ConstC2 |
| 46 | ) |
| 47 | |
| 48 | // ------------------------------------------------------------------- |
| 49 | // type alias with methods |
| 50 | // ------------------------------------------------------------------- |
| 51 | |
| 52 | // type comment |
| 53 | type SliceAlias[T any] []T // after |
| 54 | |
| 55 | // func comment |
| 56 | func (s SliceAlias[T]) funcA() { |
| 57 | } |
| 58 | |
| 59 | // multi |
| 60 | // line |
| 61 | // comment |
| 62 | func (s SliceAlias[T]) funcB(argA, argB int) { |
| 63 | } |
| 64 | |
| 65 | func (s SliceAlias[T]) funcC(argA int, argB ...string) (a T, b int, c error) { |
| 66 | return |
| 67 | } |
| 68 | |
| 69 | // ------------------------------------------------------------------- |
| 70 | // function type |
| 71 | // ------------------------------------------------------------------- |
| 72 | |
| 73 | // multi |
| 74 | // line |
| 75 | // comment |
| 76 | type Handler[T comparable] func() (T, int) // after |