9.6 为自定义包使用 godoc

    例如:

    • 在 目录下我们有第 11.7 节中的用来排序的 go 文件,文件中有一些注释(文件需要未编译)
    • 命令行下进入目录下并输入命令:

      godoc -http=:6060 -goroot=”.”

    然后你会看到本地的 godoc 页面(详见第 3.6 节)从左到右一次显示出目录中的包:

    doc_example:

    doc_example | Packages | Commands | Specification

    sort 包

    使用通用的接口排序:

    1. func Float64sAreSorted[Top]
    2. func Float64sAreSorted(a []float64) bool
    3. func IntsAreSorted[Top]
    4. func IsSorted[Top]
    5. func IsSorted(data Interface) bool
    6. Test if data is sorted
    7. func Sort[Top]
    8. General sort function
    9. func SortInts[Top]
    10. func SortInts(a []int)
    11. Convenience wrappers for common cases: type IntArray[Top]

    如果你在一个团队中工作,并且源代码树被存储在网络硬盘上,就可以使用 godoc 给所有团队成员连续文档的支持。通过设置 sync_minutes=n,你甚至可以让它每 n 分钟自动更新您的文档!