根据 github.com/golang 上的 Comment Sentences,将导出元素的名称放在评论的开头是一个约定。
示例:
// 表示运行命令的请求。 type Request struct {}
注释以结构描述开头,而不是结构名称。 为了遵守约定规则,您可以应用 向注释中添加前缀 快速修复。 应用快速修复后,注释如下所示:
// Request 表示运行命令的请求。 type Request struct {} // 更好