mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-11-13 09:16:10 +08:00
9.5
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
# 9.6 为你的自定义包使用godoc
|
||||
# 9.6 为自定义包使用 godoc
|
||||
|
||||
208
|
||||
godoc工具(3.6章节)在显示自定义包中的注释也有很好的效果:注释必须以//开始并无空行放在声明(包,类型,函数)前。godoc会为每个文件生成一系列的网页。
|
||||
|
||||
例如:
|
||||
@@ -6,7 +8,7 @@ godoc工具(3.6章节)在显示自定义包中的注释也有很好的效果:
|
||||
-在do_examples目录下我们有11.7章节中的用来排序的go文件,文件中有一些注释(文件需要未编译)
|
||||
|
||||
-命令行下进入目录下并输入命令:
|
||||
|
||||
|
||||
godoc -http =:6060 -paht="."
|
||||
|
||||
(.是指当前目录,-path参数可以是/path/to/my/package1这样的形式指出package1在你源码中的位置或接受用冒号形式分隔的路径,无根目录的路径为相对于当前目录的相对路径)
|
||||
@@ -22,13 +24,13 @@ doc_example | Packages | Commands | Specification
|
||||
|
||||
sort包
|
||||
|
||||
func Float64sAreSorted
|
||||
func Float64sAreSorted
|
||||
|
||||
type IntArray
|
||||
|
||||
func IntsAreSortedfunc IsSortedfunc Sort
|
||||
|
||||
type IntArray
|
||||
|
||||
func IntsAreSortedfunc IsSortedfunc Sort
|
||||
|
||||
func (IntArray) Len
|
||||
|
||||
func SortFloat64s
|
||||
|
||||
|
||||
Reference in New Issue
Block a user