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的更多相关文章

  1. 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 ...

  2. golang:exported function Script should have comment or be unexported

    当自己定义的包被外部使用时,如果不遵循一定的规范,那么会出现讨厌的绿色纹条,还会警告: 虽然不会影响运行,但是也令人讨厌,那么如何解决这个问题呢? 为结构体或者变量或者方法添加注释,并且开头必须是结构 ...

  3. comment on exported function Perimeter should be of the form "Perimeter ..."go-lint

    这个提示是检查代码注释格式有问题 正确方式:

  4. GOLANG 注释

    注释可提高代码可读性 编译器编译时自动忽略注释段内容 单行注释 //单行注释 块注释 /* 块注释 */

  5. IAR for msp430 MDK中 warning: #223-D: function "xxx" declared implicitly 解决方法

    今天在EINT的范例里添加了一个函数,即eint.c中添加了一个datawrite()的函数,并在主函数main.c中调用,编译便警告 warning: #223-D: function " ...

  6. JS中(function(){xxx})(); 这种写法是什么意思?

    自执行匿名函数: 常见格式:(function() { /* code */ })(); 解释:包围函数(function(){})的第一对括号向脚本返回未命名的函数,随后一对空括号立即执行返回的未命 ...

  7. (function(){xxx})(); 写法解释

    常见格式:(function() { /* code */ })(); 解释:包围函数(function(){})的第一对括号向脚本返回未命名的函数,随后一对空括号立即执行返回的未命名函数,括号内为匿 ...

  8. 理解golang中的function types

    先找个例子来看一下: package main import "fmt" // Greeting function types type Greeting func(name st ...

  9. Xcode解决“Implicit declaration of function 'XXX' is invalid in C99” 警告或报错

    1.Build Setting>>>C Language Dialect,然后选择GNU99[-std=gnu99] (选择看项目实际要求). 2.Build Setting> ...

随机推荐

  1. Java基础——变量与常量及命名规范

    变量 ()  public class Demon04{     //类变量 static     static double salary=2500;     //属性: 变量 ​     //实例 ...

  2. 大写字母与小写字母 相差 一个 空格 A = 65 a = 97 空格 = 32

    1 //大写字母与小写字母 相差 一个 空格 A = 65 a = 97 空格 = 32 2 3 #include <stdio.h> 4 int main() 5 { 6 7 char ...

  3. Spring Cloud Alibaba - RestTemplate

    Spring Cloud Alibaba - RestTemplate Controller导入依赖和相关属性 @SuppressWarnings("all") @RestCont ...

  4. Java HashMap【笔记】

    Java HashMap[笔记] HashMap HashMap 基本结构 HashMap 底层的数据结构主要是数组 + 链表 + 红黑树 其中当链表的长度大于等于 8 时,链表会转化成红黑树,当红黑 ...

  5. 【笔记】numpy.array基础(1)

    numpy.array基础 使用numpy.__version__可以检查numpy的版本 当然也可以直接使用命令行检查numpy版本 也可以用来简化引用,使用as python list特点 num ...

  6. Thymeleaf页面静态化技术

    Teymeleaf的使用 案例一:springboot搭建Thymeleaf 1.导入依赖 2.新建html页面模板 3.新建前端控制层Controller 4.新建启动类 1.导入依赖 <?x ...

  7. 基于 CODING CD + Nocalhost 在大型应用的 ChatOps 实践

    本文作者:红亚科技 CTO--卢兴民 红亚科技聚焦信息技术发展,为信息技术相关专业提供优质教学服务 背景 ChatOps 最早起源于 GitHub,它以沟通平台为中心,通过与机器人产生对话和交互,使开 ...

  8. CF上部分树形DP练习题

    本次 5 道题均来自Codeforce 关于树形DP的算法讲解:Here 791D. Bear and Tree Jumps 如果小熊每次能跳跃的距离为1,那么问题变为求树上任意两点之间距离之和. 对 ...

  9. 获取访问者真实ip地址?我觉得不可能

    我们真的能通过请求来获取用户真实的ip地址嘛? 答案是不能,如果能,肯定是我学的不够深入,欢迎交流指正. 那么写这篇文章的意义是什么?我们接着往下看. IP地址相当于电脑在网络上的身份证,但事实上IP ...

  10. docker 镜像配置

    Ubuntu14.04.Debian7Wheezy 对于使用 upstart 的系统而言,编辑 /etc/default/docker 文件,在其中的 DOCKER_OPTS 中配置加速器地址: DO ...