本文摘自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 文件名或者目录
检查结果如下:
相关阅读 >>
【发布了Go-carbon1.1.1版本】完善对主流orm的支持,新增公共方法
[Go] Golang 中main包下入口文件调用其它Go文件函数出现undefined
多协程通道的应用---三协程通过通道实现abc按顺序输出100次
更多相关阅读请进入《Go》频道 >>
Go语言101
一个与时俱进的Go编程知识库。