An open API service indexing awesome lists of open source software.

https://github.com/gostaticanalysis/vetgen

Tool: vetgen is generator of vettools
https://github.com/gostaticanalysis/vetgen

golang staticanalysis

Last synced: 25 days ago
JSON representation

Tool: vetgen is generator of vettools

Awesome Lists containing this project

README

          

# vetgen

[![CircleCI](https://circleci.com/gh/gostaticanalysis/vetgen.svg?style=svg)](https://circleci.com/gh/gostaticanalysis/vetgen)
[![GoDoc](https://godoc.org/github.com/gostaticanalysis/vetgen?status.svg)](https://godoc.org/github.com/gostaticanalysis/vetgen)

`vetgen` creates vettool with own analyzers.

## Insall

```
$ go get -u github.com/gostaticanalysis/vetgen
```

## How to use

### init

```
$ vetgen init myvet
$ cat myvet/main.go
// This file is generated by vetgen.
// Do NOT modify this file.
//
// You can run this tool with go vet such as:
// go vet -vettool=$(which myvet) pkgname
package main

// go vet
import (
"golang.org/x/tools/go/analysis/unitchecker"
"github.com/gostaticanalysis/vetgen/analyzers"
)

var myAnayzers = []*analysis.Analyzer {}

func main() {
unitchecker.Main(append(
analyzers.Recommend(),
myAnayzers...,
)
}
```

### add an analyzer

```
$ cd myvet
$ vetgen add github.com/tenntenn/mychecker
$ cat main.go
// This file is generated by vetgen.
// Do NOT modified this file.
package main

// go vet
import (
"golang.org/x/tools/go/analysis/unitchecker"
"github.com/gostaticanalysis/vetgen/analyzers"
"github.com/tenntenn/mychecker" // add by vetgen
)

var myAnayzers = []*analysis.Analyzer {
mychecker.Analyzer,
}

func main() {
unitchecker.Main(append(
analyzers.Recommend(),
myAnayzers...,
)
}
```

### run

```
$ go vet -vettool=$(which myvet) fmt
```