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