douzhuang6321 2017-04-26 15:17
浏览 229

记录Golang程序的惯用方式,它由一个main.go文件组成

I wrote a Go tool which reads files and produces output based on the input. It consists of one main.go file. Where do I document what the tool does, in order to make use of godoc (or just be idiomatic)?

// Should I explain it here?
package main

// Or here?
func main() {
    // code!
}

// Or somewhere else?
  • 写回答

1条回答 默认 最新

  • douyun1972 2017-04-26 15:44
    关注

    To document a command for godoc or godoc.org, write the command documentation in the package comment.

    // Command foo does bar.
    package main
    
    func main() {
       // code!
    }
    

    See the comment in stringer.go and the stringer documentation for an example.

    By default, godoc and godoc.org hide all other doc comments in a package with the name "main".

    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度