File tree 1 file changed +3
-48
lines changed
1 file changed +3
-48
lines changed Original file line number Diff line number Diff line change 1
- ### 0.5 go doc和godoc
2
-
3
- ** go doc**
4
-
5
- ``` go doc ``` 命令其实是使用``` godoc ``` 命令提取和生成指定代码包的文档的。``` go doc ``` 命令做的只是为``` godoc ``` 命令检查和设置正确的代码包路径,以及在其上追加几个额外的可用标记。``` go doc ``` 命令的可用标记如下表。
6
-
7
- _ 表0-5 ``` go doc ``` 命令的标记说明_
8
- <table class =" table table-bordered table-striped table-condensed " >
9
- <tr >
10
- <th width=25%>
11
- 标记名称
12
- </th>
13
- <th>
14
- 标记描述
15
- </th>
16
- </tr >
17
- <tr >
18
- <td>
19
- -n
20
- </td>
21
- <td>
22
- 打印所用的命令,但是并不真正执行。
23
- </td>
24
- </tr >
25
- <tr >
26
- <td>
27
- -x
28
- </td>
29
- <td>
30
- 打印所用的命令。
31
- </td>
32
- </tr >
33
- </table >
34
-
35
- 这两个标记的含义非常简单,而且它们在其它命令中也都是有效的。
36
-
37
- ``` go doc ``` 命令在执行时会首先在检查和设置代码包导入路径。然后将代码包导入路径作为参数传递给``` godoc ``` 命令。
38
-
39
- hc@ubt:~/golang/goc2p$ go doc -n logging
40
- godoc logging
41
-
42
- 如果我们用本地代码包路径提供代码包位置,那么``` go doc ``` 命令会首先把它转换为标准的代码包导入路径,并传递给``` godoc ``` 命令。现在我们用代码包的目录相对路径作为命令参数:
43
-
44
- hc@ubt:~/golang/goc2p$ go doc -n ./src/logging
45
- godoc logging
46
-
47
- 我们看到,这里在执行``` godoc ``` 命令时同样是以logging作为参数的。
1
+ ### 0.5 godoc
2
+
48
3
49
4
** godoc**
50
5
@@ -133,4 +88,4 @@ _图0-2 goc2p项目中的pkgtool包的Go文档页面_
133
88
## links
134
89
* [ 目录] ( catalog.md )
135
90
* 上一节: [ go clean] ( 0.4.md )
136
- * 下一节: [ go run] ( 0.6.md )
91
+ * 下一节: [ go run] ( 0.6.md )
You can’t perform that action at this time.
0 commit comments