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