小编典典

如何使用godoc创建文档?

go

我在应用程序中对函数和我尝试过的包godoc -html以及应用程序和结果创建了简单的注释

<!--
    Copyright 2009 The Go Authors. All rights reserved.
    Use of this source code is governed by a BSD-style
    license that can be found in the LICENSE file.
-->

<!--
        Note: Static (i.e., not template-generated) href and id
        attributes start with "pkg-" to make it impossible for
        them to conflict with generated attributes (some of which
        correspond to Go identifiers).
-->

        <script type='text/javascript'>
        document.ANALYSIS_DATA = ;
        document.CALLGRAPH = ;
        </script>



                <p>
Package main provides logic ...
</p>

为什么我没有看到其他文件?以及为什么<p>包的空格

// Package main provides logic.
package main
import (

}

some types.....

func main() {
}

// doLogic .....
// .....
// ....
func (sm *myI) doLogic (s *myStruct) bool {

}

阅读 337

收藏
2020-07-02

共1个答案

小编典典

默认情况下,未记录未导出的标识符。至少设置?m=all为查看它们:

可以使用“ m” URL参数来控制godoc服务的网页的显示方式;它接受以逗号分隔的标志名称列表作为值:

all     show documentation for all declarations, not just the exported

ones
methods show all embedded methods, not just those of unexported
anonymous fields
src show the original source code rather then the extracted
documentation

例如,https://golang.org/pkg/math/big/?m=
all显示了big包的所有(不仅是导出的)声明的文档。
https://godoc.org/golang.org/x/tools/cmd/godoc

2020-07-02