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> ...
随机推荐
- JVM学习笔记-第六章-类文件结构
JVM学习笔记-第六章-类文件结构 6.3 Class类文件的结构 本章中,笔者只是通俗地将任意一个有效的类或接口锁应当满足的格式称为"Class文件格式",实际上它完全不需要以磁 ...
- Git(6)-- 记录每次更新到仓库(git clone、status、add、diff、commit、rm、mv命令详解)
@ 目录 1.克隆现有仓库:git clone 2.检查当前文件状态 :git status 3.跟踪新文件:git add 4.暂存已修改的文件:git add 5.状态简览: git status ...
- kcptun安装
- 轻松上手SpringBoot+SpringSecurity+JWT实RESTfulAPI权限控制实战
前言 我们知道在项目开发中,后台开发权限认证是非常重要的,springboot 中常用熟悉的权限认证框架有,shiro,还有就是springboot 全家桶的 security当然他们各有各的好处,但 ...
- 微信小程序开发(二)——使用WeUI组件库
一.前言 因为小程序的api描述都比较简单,并没有wxml及wxss的描述,一定会想小程序有没有一个UI库,类似于前端中的Bootstrap,MD,Semantic UI这样的框架UI库.有的,它就是 ...
- NOIP 模拟 $14\; \text{抛硬币}$
题解 \(by\;\;zj\varphi\) 签到题,自己看题解 Code #include<bits/stdc++.h> #define ri register signed #defi ...
- 在docker安装tomcat的时候,报错:Caused by: java.lang.IllegalArgumentException: The AJP Connector is configured with secretRequired="true
初识docker,试着在docker中安装tomcat(安装的tomcat8.5),并且挂载到宿主机的相关目录下,结果启动的时候报错: 12-May-2020 01:14:34.061 SEVERE ...
- WPF material UI 的使用
网站:https://github.com/vasanthmes/WPF-Dashboard-UI-Material-Design-Concept theme <Application x:Cl ...
- CSS定位(慕课网学习笔记)
定位模型 static自然模型 relative相对定位模型 absolute绝对定位模型 fixed固定定位模型 sticky磁铁定位模型 possition之static(默认的设置)(静态定位. ...
- CAS 的ABA 问题
CAS CAS:Compare and Swap, 翻译成比较并交换. java.util.concurrent包中借助CAS实现了区别于synchronized同步锁的一种乐观锁. 其原理是CAS有 ...