Go语言 如何写Godoc
在本地开启Godoc
godoc -http :6060为各种function写说明
package queue
// A FIFO queue.
type Queue []int
// Pushes the element into the queue.
// e.g. q.Push(123)
func (q *Queue) Push(v int) {
*q = append(*q, v)
}
// Pops element from head.
func (q *Queue) Pop() int {
head := (*q)[0]
*q = (*q)[1:]
return head
}
// Returns if the queue is empty or not.
func (q *Queue) IsEmpty() bool {
return len(*q) == 0
}代码实例

Last updated
Was this helpful?