goci is a CI linter for Go(lang) source code.
It supports:
build
project buildgofmt
gofmt checkinggovet
code quality checkinggolint
code style checkingtest
go test or unit testrace
race condition test
- Go1.10.x
- Go1.11 (go module support)
$go get -u github.com/barryz/goci
$goci -c goci.yml
or
$goci # use default configurations
Create a file which named goci.yml
. This file should include fields as below:
fields | type | comment |
---|---|---|
build | string | Command or script that used for build project. Scripts should use the relative path. eg: ./ |
test | string | Command for testing |
excludes | array | The directories which in excludes will not be gofmt , golint or gover |
race | struct | Execute race condition testing |
lint | struct | Configurations for golint |
skips | array | Steps which to skipped |
fields | type | comment |
---|---|---|
main | string | entry-point file for project, eg:main.go |
main_cmd | string | command for execution |
script | string | test script eg: sh race_test.sh |
timeout | int | timeout for race condition execution |
fields | type | comment |
---|---|---|
ignore_no_comment_error | bool | false(default) |
Example:
build: go build
test: go test
excludes:
- templates # except templates
- vendor # except vendor
race:
# go run -race main.go
main: ./main.go
# kill the above after 20 seconds
timeout: 20
# run this script to interact with the above running process (as a test)
script: ./ab.sh
# after 20 seconds, if no race detected, the goci/race passs
skips:
- fmt