本文摘自php中文网,作者尚,侵删。

根据作者的说法:
Golint is a linter for Go source code.
Golint differs from gofmt. Gofmt reformats Go source code, whereas
golint prints out style mistakes.
Golint differs from govet. Govet is concerned with correctness, whereas
golint is concerned with coding style. Golint is in use at Google, and it
seeks to match the accepted style of the open source Go project.
一句话就是Golint用于检查go代码中不够规范的地方。
一、编译及生成可执行程序
1、下载golang 的 lint,下载地址:https://github.com/golang/lint
2、解压文件到$GOPATH/src/github.com/golang/lint
3、到目录$GOPATH/src/github.com/golang/lint/golint中运行go build ./
4、在当前目录有golint的可执行程序
当然,最简单的方式是:
1 2 |
|
二、执行方式:
golint 文件名或者目录
检查结果如下:
相关阅读 >>
protoc Go插件编写之四 (实现生成自己的proto文件)
更多相关阅读请进入《Go》频道 >>

Go语言101
一个与时俱进的Go编程知识库。