简体   繁体   English

Golang var 应该有注释或者不应该被导出

[英]Golang var should have comment or should be unexported

I am facing this error in my Go code exported var should have a comment or be unexported error message我在 Go 代码中遇到此错误 导出的 var 应该有注释或未导出错误消息

install.go:44:2: exported var URLSuffix should have comment or be unexported install.go:44:2: 导出的 var URLSuffix 应该有注释或未导出

URLSuffix start with an uppercase letter, so it is exported, so add a comment right before it, as described in the Code Review guide , and effective Go commentary : URLSuffix以大写字母开头,因此被导出,因此在其前面添加注释,如代码审查指南中所述,以及有效的 Go 注释

// URLSuffix is ... (complete here)
URLSuffix aType

This is a warning from golang/lint , illustrated in golang/lint issue 191 .这是来自golang/lint警告,在golang/lint issue 191中有说明。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM