mirror of
https://github.com/hanzoai/team.git
synced 2026-09-30 01:57:35 +00:00
* inline mattermost-govet * fix style issues * simplify the openApiSync spec test * README.md tweaks * fix missing licenses * simplify README.md * trigger server-ci on tools/mattermost-govet/** * Apply https://github.com/mattermost/mattermost-govet/commit/470cf78253f0aa85a4f4b5b50002682bf823e729 --------- Co-authored-by: Mattermost Build <[email protected]>
1.7 KiB
1.7 KiB
Mattermost Go Vet
This package contains mattermost-specific go-vet rules that are used to maintain code consistency in mattermost.
Included analyzers
- equalLenAsserts - check for (require/assert).Equal(t, X, len(Y))
- inconsistentReceiverName - check for inconsistent receiver names in the methods of a struct
- license - check the license header
- openApiSync - check for inconsistencies between OpenAPI spec and the source code
- structuredLogging - check invalid usage of logging (must use structured logging)
- tFatal - check invalid usage of t.Fatal assertions (instead of testify methods)
- apiAuditLogs - check that audit records are properly created in the API layer
- rawSql - check invalid usage of raw SQL queries instead of using the squirrel lib
- emptyStrCmp - check for idiomatic empty string comparisons
- pointerToSlice - check for usage of pointer to slice in function definitions
- mutexLock - check for cases where a mutex is left locked before returning
- wrapError - check for original errors being passed as details rather than wrapped
- noSelectStar - check for SQL queries using SELECT * which breaks forwards compatibility
- requestCtxNaming - check that request.CTX parameters are consistently named 'rctx'
Running Locally
Mattermost Go Vet lives in the tools/mattermost-govet/ directory of the mattermost/mattermost repo. It can also be imported and installed independently for use by plugins or other projects:
go install github.com/mattermost/mattermost/tools/mattermost-govet@latest
To build and run locally from the repo:
cd tools/mattermost-govet && go install .
go vet -vettool=$(go env GOPATH)/bin/mattermost-govet ./...