golint的简易使用方法


本文摘自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

go get github.com/golang/lint

go install github.com/golang/lint

二、执行方式:

golint 文件名或者目录

检查结果如下:

阅读剩余部分

相关阅读 >>

性能优化+架构迭代升级 Go读书社区web开发与架构优化

Golang中map与并发

Go语言学习11-数据的使用

手撸Golang spring ioc/aop 之1

Go版webrtc解密base64执行结果程序终止原因分析

rabbitmq 死信 延时队列 [Go版本]

新手入门Golang开发的注意事项

protoc Go插件编写之四 (实现生成自己的proto文件)

Go语言开篇

如何用 Go 语言写出好用的 http 中间件?

更多相关阅读请进入《Go》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...