from Hacker News

Show HN: Lint – run linters from go test

by vendakka on 11/14/16, 1:32 PM with 1 comments

  • by vendakka on 11/14/16, 1:38 PM

    Hi,

    I'm the author. Please let me know if you have any questions or comments.

    This library allows you to run a variety of linters as part of go test. It also supports whitelisting false positives. It reduces the need for build scripts, makes CI integration easy and lets projects enforce linter usage without extra scripts. I built it while working on our mobile app (which is written in Go) and have found it useful so far.

    The below example test will check for gofmt usage, run go tool vet --shadow, golint, errcheck, gosimple and gostaticcheck

      import (
          "testing"
          "github.com/surullabs/lint"
      ) 
    
    
      func TestLint(t *testing.T) {
          if err := lint.Default.Check("./..."); err != nil {
              t.Fatal("lint failures: %v", err)
          }
      }
    
    Please let me know if you find this useful and if you'd like any features added/removed/modified.