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. Spring Cloud Alibaba - Gateway

    Gateway Gateway简介 底层使用Netty框架,性能大于Zuul 配置gateway模块,一般使用yaml格式: server: port: 80 #spring boot actuato ...

  2. 实战爬取某网站图片-Python

    直接上代码 1 #!/usr/bin/python 2 # -*- coding: UTF-8 -*- 3 from bs4 import BeautifulSoup 4 import request ...

  3. Linux之cat tail less常见用法

    1.cat 通常查找出错误日志 cat error.log | grep 'foo' , 这时候我们还有个需求就是输出当前这个日志的前后几行: cat error.log | grep -C 10 ' ...

  4. 泛微OA e-cology 数据库接口信息泄露学习

    泛微OA e-cology 数据库接口信息泄露 漏洞信息 攻击者可通过存在漏洞的页面直接获取到数据库配置信息.如果攻击者可直接访问数据库,则可直接获取用户数据,甚至可以直接控制数据库服务器:会将当前连 ...

  5. 005 媒体访问控制(MAC,Media Access Control)

    一,MAC MAC是媒体访问控制器.以太网MAC由IEEE-802.3以太网标准定义.它实现了数据链路层.最新的MAC同时支持10/100/1000Mbps速率.通常情况下,它实现MII/GMII/R ...

  6. metasploit的数据库配置

    metasploit所处位置:/usr/share/metasploit-framework msf数据库连接命令:db_connect msf:msfadmin@127.0.0.1/msf 1.启动 ...

  7. 题解 Game

    传送门 一有「字典序最大」什么的的就懵了--这题我颓的std 首先可以发现全局最大得分很好统计,我们令它为 \(k\) 然后我们尝试构造方案,但发现无论怎么放都可能会有后效性 发现对于一个位置,可以放 ...

  8. WPF 饼状图,柱形图,折线图 (2 折线图)

    折线图在柱形图的基础上,做了一些修改.大概效果和用法如下. X轴和Y轴的刻度,使用用了Path的Figures属性,绘制多条Figure+LineSegment完成. 同时,由于折线图很可能会画多条线 ...

  9. Qt迭代器(Java类型和STL类型)详解

    迭代器为访问容器类里的数据项提供了统一的方法,Qt 有两种迭代器类:Java 类型的迭代器和 STL 类型的迭代器. 两者比较,Java 类型的迭代器更易于使用,且提供一些高级功能,而 STL 类型的 ...

  10. mysql基础操作(二):简单查询DQL

    -- 1.查询所有字段 select * from student; -- 2.查询指定的字段 select id from student; select id, name from student ...