vetgen

command module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 23, 2020 License: MIT Imports: 15 Imported by: 0

README

vetgen

CircleCI GoDoc

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

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL