2 回答

TA貢獻1875條經驗 獲得超3個贊
您可以通過在本地運行以下文件檢查器和 linters 來獲得相同的結果:
gofmt
go_vet
gocyclo
golint
ineffassign
license
misspell
所有這些都可以從命令行運行。
如果您想擁有一種工具,我會推薦 gometalinter。?
go get -u github.com/alecthomas/gometalinter
gometalinter --install
gometalinter --deadline=90s --disable-all ... #other flags

TA貢獻1871條經驗 獲得超8個贊
以下是在本地或私人服務器中安裝和獲取報告的方法:
1)先決條件(在運行之前goreportcard-cli,需要安裝一些依賴項)
$ go get -u golang.org/x/lint/golint
$ go get github.com/fzipp/gocyclo
$ go get -u github.com/client9/misspell/cmd/misspell
$ go get github.com/gordonklaus/ineffassign
#deprecated, a reported issue in goreportcard-cli to switch to use golangcli-lint instead
$ go get github.com/alecthomas/gometalinter
2) 現在,在您的項目目錄中安裝cli并運行它:
#get whole project (for demo purpose only)
go get github.com/gojp/goreportcard/...
注意:在實際環境中,您可能只需要安裝cli
$ go get github.com/gojp/goreportcard/cmd/goreportcard-cli
3)測試它:轉到項目(私人回購或在您的本地項目中運行它)
$ cd $GOPATH/src/github.com/gojp/goreportcard
$ goreportcard-cli
你應該得到這樣的東西
? goreportcard-cli
Grade: A+ (98.9%)
Files: 403
Issues: 39
gofmt: 100%
go_vet: 99%
golint: 100%
gocyclo: 91%
ineffassign: 99%
license: 100%
misspell: 100%
- 2 回答
- 0 關注
- 158 瀏覽
添加回答
舉報