Lingo helps you define and enforce project-specific Go lingo.
Lingo is a tool for fully-automated static code analysis of Go code. It is designed to be integrated in continuous delivery pipelines and act as a single source of truth for a project's code style.
To install the latest version of lingo execute:
go get -u github.com/s2gatev/lingo
The static analysis checks performed by lingo are defined in a configuration file
that needs to be provided upon execution. The following example defines five
static analysis checks that are executed against all .go
files except those
under vendor/
and those with names ending in _test
:
matchers:
-
type: 'glob'
config:
pattern: '**/*.go'
-
type: 'not'
config:
type: 'glob'
config:
pattern: '**/vendor/**/*'
-
type: 'not'
config:
type: 'glob'
config:
pattern: '**/*_test.go'
checkers:
local_return:
multi_word_ident_name:
exported_ident_doc:
test_package:
consistent_receiver_names:
Here is a list of the available checkers.
To check all files rooted at the current directory for lingo violations execute:
lingo check ./...
To read a guide with all the lingo rules applicable for the project execute:
lingo guide
- Fork the project
- Clone your fork (
git clone https://github.com/username/lingo && cd lingo
) - Create a feature branch (
git checkout -b new-feature
) - Make changes and add them (
git add .
) - Make sure tests are passing and coverage is good (
go test ./... -race -cover
) - Make sure code style is matching the lingo of the project (
lingo ./...
) - Commit your changes (
git commit -m 'Add some feature'
) - Push the branch (
git push origin new-feature
) - Create a new pull request
Lingo draws huge inspiration from RuboCop and other Go tools such as dep, cobra and golint.
Copyright (c) 2017 Stanislav Gatev. See LICENSE for further details.