github: https://github.com/golang/lintjavascript
golint是相似javascript中的jslint的工具,主要功能就是检测代码中不规范的地方。golint用于检测go代码。java
$ go get github.com/golang/lint $ go install github.com/golang/lint
golint 文件名或者目录
检测对应的代码。git
golint会输出一些代码存在的问题:
好比:github
recorder.go:55:5: exported var RecordBind should have comment or be unexported recorder.go:158:1: exported function Record_ErrorRecord should have comment or be unexported recorder.go:173:6: don't use underscores in Go names; type Data_MemStats should be DataMemStats recorder.go:179:2: struct field FreeRam should be FreeRAM
上面的输出中文件recorder.go,179行,在struct中字段FreeRam
应该是 FreeRAM
,输出信息很是的详细golang
golint 会检测的方面:工具
等等
详细能够看官方库示例,https://github.com/golang/lint/tree/master/testdatacode