golang 注释 exported function xxx should have comment or be unexported
0x00 问题
exported function xxx should have comment or be unexported。

0x01 解决
https://golang.org/s/style 在这个页面中有提到
Comment SentencesSee https://golang.org/doc/effective_go.html#commentary. Comments documenting declarations should be full sentences, even if that seems a little redundant. This approach makes them format well when extracted into godoc documentation. Comments should begin with the name of the thing being described and end in a period:
记录声明的注释应该是完整的句子,即使这看起来有点多余。这种方法使它们在提取到 godoc 文档时格式良好。注释应以所述物品的名称开始,并以句号结束:
// Request represents a request to run a command.
type Request struct { ...
// Encode writes the JSON encoding of req to w.
func Encode(w io.Writer, req *Request) { ...
正是如此,golint 才会抛出这条警告,声明你写的代码不符合规范。
符合规范的修改:

在方法调用中,能看到注释信息:

golang 注释 exported function xxx should have comment or be unexported的更多相关文章
- exported function xxx should have comment or be unexported
0x00 问题 exported function xxx should have comment or be unexported. 0x01 解决 https://golang.org/s/sty ...
- golang:exported function Script should have comment or be unexported
当自己定义的包被外部使用时,如果不遵循一定的规范,那么会出现讨厌的绿色纹条,还会警告: 虽然不会影响运行,但是也令人讨厌,那么如何解决这个问题呢? 为结构体或者变量或者方法添加注释,并且开头必须是结构 ...
- comment on exported function Perimeter should be of the form "Perimeter ..."go-lint
这个提示是检查代码注释格式有问题 正确方式:
- GOLANG 注释
注释可提高代码可读性 编译器编译时自动忽略注释段内容 单行注释 //单行注释 块注释 /* 块注释 */
- IAR for msp430 MDK中 warning: #223-D: function "xxx" declared implicitly 解决方法
今天在EINT的范例里添加了一个函数,即eint.c中添加了一个datawrite()的函数,并在主函数main.c中调用,编译便警告 warning: #223-D: function " ...
- JS中(function(){xxx})(); 这种写法是什么意思?
自执行匿名函数: 常见格式:(function() { /* code */ })(); 解释:包围函数(function(){})的第一对括号向脚本返回未命名的函数,随后一对空括号立即执行返回的未命 ...
- (function(){xxx})(); 写法解释
常见格式:(function() { /* code */ })(); 解释:包围函数(function(){})的第一对括号向脚本返回未命名的函数,随后一对空括号立即执行返回的未命名函数,括号内为匿 ...
- 理解golang中的function types
先找个例子来看一下: package main import "fmt" // Greeting function types type Greeting func(name st ...
- Xcode解决“Implicit declaration of function 'XXX' is invalid in C99” 警告或报错
1.Build Setting>>>C Language Dialect,然后选择GNU99[-std=gnu99] (选择看项目实际要求). 2.Build Setting> ...
随机推荐
- 跟你说个笑话,硕士毕业两年,月薪10k,天天面向CV编程
"枯燥乏味的一天,又tm要开始了". 早上10:00,程序员毛毛带着路上买的早餐,打开24英寸的显示屏,去某论坛查一下昨天没有解决的bug. 9 个小时增删改查.搬砖写代码的一天又 ...
- Windows根据端口号查找对应的进程和服务
需求 1,我们在Win10安装一些Web服务时,会发现默认端口被占用,比如443端口被占用,808端口被占用,那么如何找出占用这些默认端口的进程和对应的服务呢? 2,系统安装完成后,会有一些应用对外开 ...
- .net core 响应的json数据驼峰显示问题。
在.net core webapi中,默认响应的json数据是以驼峰显示的,即首字母小写的方式.如果让其正常显示,只需要在全局配置即可.代码如下图: 配置之后,响应数据就不会再以驼峰的形式展示了.而是 ...
- Send Excerpts from Jenkins Console Output as Email Contents
Sometimes we need to send some excerpts from Jenkins console output (job logs) as email, such as tes ...
- 服务器put请求获取不到参数
问题 put请求参数映射成实体类 而参数似乎接受不到,服务器识别为null 解决 在参数前边加上RequestBody @RequestBody主要用来接收前端传递给后端的json字符串中的数据的(请 ...
- PrismWPF网盘
技术点 文件分片上传与下载 Vue 正在努力中.... 客户端 采用 WPF:Net5+Prism8+RestSharp 客户端基本结构如下 模块说明 Model: 主要放置Prism模块 ZFile ...
- 【错误】element cannot be mapped to a null key
element cannot be mapped to a null key的解决方法 报错: ERROR [o.a.c.c.C.[.[.[/sa].[dispatcherServlet]] - Se ...
- 如何发送一个http请求—apipost
API界面功能布局 API请求参数 Header 参数 你可以设置或者导入 Header 参数,cookie也在Header进行设置 Query 参数 Query 支持构造URL参数,同时支持 RES ...
- 2021 年 iOS 应用程序开发七种最佳语言
移动应用程序现在几乎是每个在线业务的必备品.最新的 StatCounter 数据显示,多达56% 的在线连接是通过移动设备建立的,这使它们高于平板电脑和计算机.更重要的是,同一个消息来源说,其中27% ...
- NOIP 模拟 $36\; \rm Cicada 与排序$
题解 \(by\;zj\varphi\) 设 \(rk_{i,j}\) 表示第 \(i\) 个数最后在相同的数里排第 \(j\) 位的概率. 转移时用一个 \(dp\),\(dp_{i,j,0/1}\ ...