gpt4 book ai didi

go - 如何使用 godoc 创建文档?

转载 作者:数据小太阳 更新时间:2023-10-29 03:32:30 24 4
gpt4 key购买 nike

我在应用程序中创建简单的 go with comment 到函数和包我尝试了 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 {

}

最佳答案

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

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

关于go - 如何使用 godoc 创建文档?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53187692/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com