A shell script to do various checks on Go code.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
README.md
godoc.go
gosweep.sh

README.md

GoSweep

This script performs the build, test and automatic checking of a Go package and its sub-packages using:

  1. gofmt
  2. goimports
  3. golint
  4. go vet
  5. ineffassign
  6. race detector
  7. test coverage on package and its sub-packages, /vendor directories excluded
  8. goveralls
  9. gocyclo
  10. misspell

Migrated from my Gist.

Dependencies

To setup all the dependencies need to run the script do:

$ go get -v github.com/client9/misspell/cmd/misspell
$ go get -v github.com/fzipp/gocyclo
$ go get -v github.com/golang/lint/golint
$ go get -v github.com/gordonklaus/ineffassign
$ go get -v github.com/h12w/gosweep
$ go get -v github.com/mattn/goveralls
$ go get -v golang.org/x/tools/cmd/goimports

Environment variables

  • GOCYCLO_COMPLEXITY: maximum allowed function complexity threshold (default: 5).
  • MISSPELL_LOCALE: English locale (default: US).

If you wish to set this for a project you can create a .gosweep file. For example:

$ cat .gosweep
GOCYCLO_COMPLEXITY=5
MISSPELL_LOCALE='US'

Continuous Integration

travis-ci

Example of .travis.yml file for Go:

language: go
cache:
  directories:
    - ${GOPATH}/src/github.com/${TRAVIS_REPO_SLUG}/vendor
    - ${GOPATH}/src/github.com/fzipp
    - ${GOPATH}/src/github.com/golang
    - ${GOPATH}/src/github.com/gordonklaus
    - ${GOPATH}/src/github.com/h12w
    - ${GOPATH}/src/github.com/mattn
go:
  - tip
  - 1.8
  - 1.7
  - 1.6
sudo: false

env:
    CI_SERVICE=travis-ci

install:
  - go get -v github.com/client9/misspell/cmd/misspell
  - go get -v github.com/fzipp/gocyclo
  - go get -v github.com/golang/lint/golint
  - go get -v github.com/gordonklaus/ineffassign
  - go get -v github.com/h12w/gosweep
  - go get -v github.com/mattn/goveralls
  - go get -v -u golang.org/x/tools/cmd/goimports

script:
  - bash ${GOPATH}/src/github.com/h12w/gosweep/gosweep.sh