go doc

godoc

命令godoc是一个很强大的工具,同样用于展示指定代码包的文档。并且提供网页选择。

开启godoc -http=localhost:6060

可以在官方包之后的third-party部分找到对应的GOPATH里面自己的或下载的其他包。

go_doc

go doc命令可以打印附于Go语言程序实体上的文档。我们可以通过把程序实体的标识符作为该命令的参数来达到查看其文档的目的。

下面是一个包的go doc输出:

package suite // import "learning/cobra_demo/download_suite/suite"

Package suite to download one suite images.

    Now support meituri.

func DonwloadSuite(iSuite ISuiteOperator, countFanOut int, folderPath string, title string)
func IsDir(path string) bool
func IsFile(path string) bool
func IsFileOrFolderExists(path string) bool
type ISuiteOperator interface{ ... }
type MeituriSuite struct{ ... }
    func NewMeituriSuite(firstPage string) *MeituriSuite

还支持其他参数,-all可以一并显示文档等。