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 才会抛出这条警告,声明你写的代码不符合规范。

符合规范的修改:

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

exported function xxx should have comment or be unexported的更多相关文章

  1. 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/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. IAR for msp430 MDK中 warning: #223-D: function "xxx" declared implicitly 解决方法

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

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

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

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

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

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

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

  8. 在IAR使用FreeRTOS出现Error[Pa045]: function "XXX" has no prototype

    FreeRTOS官方例程中设置了需要“Require prototype”,所以每个函数(除了main函数)都需要函数声明,其中对于无形参的函数声明要加void,比如void led_init(voi ...

  9. Go 安装配置golint

    原文链接:http://zhoubotong.site/post/3.html一. Golint介绍 Golint 是一个源码检测工具用于检测代码规范 Golint 不同于gofmt, Gofmt用于 ...

随机推荐

  1. c#零碎知识随笔

    1. 字符串转换日期: DateTime.ParseExact(item.Attribute("event-timestamp").Value,"dd.MM.yyyy H ...

  2. Asp.Net url参数加密存在特殊符号处理方法

    Url出现了有+,空格,/,?,%,#,&,=等特殊符号的时候,服务器端无法获得正确的参数值,解决办法. 使用System.Web.HttpUtility.UrlEncode()方法将这些字符 ...

  3. Hash的应用

    思路:此题比较简单,直接贴代码 #include <stdio.h> int main(){ int N; ){ ]={}; ;i<N;i++){ int x; scanf(&quo ...

  4. Python 爬虫:煎蛋网妹子图

    使用 Headless Chrome 替代了 PhatomJS. 图片保存到指定文件夹中. import requests from bs4 import BeautifulSoup from sel ...

  5. 洛谷P3150 pb的游戏(1) 题解

    题目链接: https://www.luogu.org/problemnew/show/P3150 分析: 这道题是一道典型的入门博弈论.我们可以进行如下考虑: 先引入一个奇偶的性质: 奇数=奇数+偶 ...

  6. c++小游戏——彩票

    #include <cstdlib> #include <iostream> #include <cstdio> #include <cmath> #i ...

  7. Pascal到c++,求大佬翻译!

    请大佬翻译完毕后私信我谢谢! var a,b,c,d,f:array[1..1000]of longint; i,j,k,n,m,o:longint; procedure zx(p,q:longint ...

  8. Java NIO学习系列五:I/O模型

    前面总结了很多IO.NIO相关的基础知识点,还总结了IO和NIO之间的区别及各自适用场景,本文会从另一个视角来学习一下IO,即IO模型.什么是IO模型?对于不同人.在不同场景下给出的答案是不同的,所以 ...

  9. [剑指offer] 3. 从头到尾打印链表

    题目描述 输入一个链表,按链表值从尾到头的顺序返回一个ArrayList. 思路: 利用容器,遍历一遍加入到一个新容器里,然后反置输出. vector 用 reverse stack 则直接一个个出栈 ...

  10. PhpCms V9中的{date('Y-m-d',$r[inputtime])}问题解决方法

    不少朋友会碰到这个问题:在PhpCms V9中的首页或者文章内容页调用发布时间{date('Y-m-d',$r[inputtime])}调用显示1970-01-01,然后尝试用截断的方法也没有成功,应 ...