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-carbon1.1.1版本】完善对主流orm的支持,新增公共方法

[Go] Golang 中main包下入口文件调用其它Go文件函数出现undefined

web安全学习方法与职业介绍-1

手撸Golang 行为型设计模式 模板方法模式

Golang 架构设计原则 合成复用原则

Go modules里使用Go get进行包管理的介绍

Golang的压测工具 hey

Go是解释型语言还是编译型语言

多协程通道的应用---三协程通过通道实现abc按顺序输出100次

Golang配置私有仓库Go get

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




打赏

取消

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

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

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

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

评论

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