首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用godoc打开当前包的文档?

如何使用godoc打开当前包的文档?
EN

Stack Overflow用户
提问于 2021-07-09 06:02:03
回答 1查看 186关注 0票数 1

我只想显示一个包的文档。我尝试过godoc github.com/user/repo,就像其他答案所说的那样,但我得到了以下错误:

代码语言:javascript
复制
$ godoc github.com/user/repo
Unexpected arguments. Use "go doc" for command-line help output instead. For example, "go doc fmt.Printf".
usage: godoc -http=localhost:6060
  -analysis string
        comma-separated list of analyses to perform when in GOPATH mode (supported: type, pointer). See https://golang.org/lib/godoc/analysis/help.html
  -goroot string
        Go root directory (default "/usr/local/Cellar/go/1.16.5/libexec")
  -http string
        HTTP service address (default "localhost:6060")
  -index
        enable search index
  -index_files string
        glob pattern specifying index files; if not empty, the index is read from these files in sorted order
  -index_interval duration
        interval of indexing; 0 for default (5m), negative to only index once at startup
  -index_throttle float
        index throttle value; 0.0 = no time allocated, 1.0 = full throttle (default 0.75)
  -links
        link identifiers to their declarations (default true)
  -maxresults int
        maximum number of full text search results shown (default 10000)
  -notes string
        regular expression matching note markers to show (default "BUG")
  -play
        enable playground
  -templates string
        load templates/JS/CSS from disk in this directory
  -timestamps
        show timestamps with directory listings
  -url string
        print HTML for named URL
  -v    verbose mode
  -write_index
        write index to a file; the file name must be specified with -index_files
  -zip string
        zip file providing the file system to serve; disabled if empty

我应该如何使用godocs来只显示我的包的文档?

EN

回答 1

Stack Overflow用户

发布于 2021-07-09 06:54:53

如果您只需要命令行帮助,请执行go docgo doc -all

如果你想要浏览器版本,那就有点奇怪了。如果您的包位于名为something的文件夹中,则需要移动该文件夹,使其如下所示:

代码语言:javascript
复制
godoc/src/something

然后,转到godoc文件夹,运行

代码语言:javascript
复制
godoc -goroot .

然后,浏览到localhost:6060

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/68309080

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档