douna2633 2018-11-07 10:33
浏览 91
已采纳

如何使用godoc在GO中创建文档?

I create simple go with comment in the application to the function and the package I tried godoc -html and my application and the result

<!--
    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>

why I didn't see my other document ? and why the <p> for the package has spaces

// Package main provides logic.
package main
import (

}

some types.....

func main() {
}

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

}
  • 写回答

1条回答 默认 最新

  • duanru6816 2018-11-07 11:20
    关注

    Unexported identifiers are not documented by default. Set at least ?m=all to see them:

    The presentation mode of web pages served by godoc can be controlled with the "m" URL parameter; it accepts a comma-separated list of flag names as value:

    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
    

    For instance, https://golang.org/pkg/math/big/?m=all shows the documentation for all (not just the exported) declarations of package big. https://godoc.org/golang.org/x/tools/cmd/godoc

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥20 ML307A在使用AT命令连接EMQX平台的MQTT时被拒绝
  • ¥20 腾讯企业邮箱邮件可以恢复么
  • ¥15 有人知道怎么将自己的迁移策略布到edgecloudsim上使用吗?
  • ¥15 错误 LNK2001 无法解析的外部符号
  • ¥50 安装pyaudiokits失败
  • ¥15 计组这些题应该咋做呀
  • ¥60 更换迈创SOL6M4AE卡的时候,驱动要重新装才能使用,怎么解决?
  • ¥15 让node服务器有自动加载文件的功能
  • ¥15 jmeter脚本回放有的是对的有的是错的
  • ¥15 r语言蛋白组学相关问题