Hacker News new | ask | show | jobs
Show HN: Lint – run linters from go test (timeferret.com)
2 points by vendakka 3503 days ago
1 comments

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.