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 文件名或者目录

检查结果如下:

阅读剩余部分

相关阅读 >>

手撸Golang etcd raft协议之9

Go语言标准库之strconv

软件测试 编写技术简历的 7 个良心建议!记得收藏!!!

【发布了Go-carbon1.1.1版本】完善对主流orm的支持,新增公共方法

Go封装、继承、多态

聊聊cortex的tenant

聊聊dapr的pipeline

手撸Golang Go与微服务 saga模式之3

Golang json格式化自定义日期格式

jenkins构建Go及java项目

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




打赏

取消

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

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

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

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

评论

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