func Main(analyzers ...*analysis.Analyzer) {
	progname := filepath.Base(os.Args[0])
	log.SetFlags(0)
	log.SetPrefix(progname + ": ")

	if err := analysis.Validate(analyzers); err != nil {
		log.Fatal(err)
	}

	flag.Usage = func() {
		fmt.Fprintf(os.Stderr, `%[1]s is a tool for static analysis of Go programs.

Usage of %[1]s:
	%.16[1]s unit.cfg	# execute analysis specified by config file
	%.16[1]s help    	# general help
	%.16[1]s help name	# help on specific analyzer and its flags
`, progname)
		os.Exit(1)
	}

	analyzers = analysisflags.Parse(analyzers, true)

	args := flag.Args()
	if len(args) == 0 {
		flag.Usage()
	}
	if args[0] == "help" {
		analysisflags.Help(progname, analyzers, args[1:])
		os.Exit(0)
	}
	if len(args) != 1 || !strings.HasSuffix(args[0], ".cfg") {
		log.Fatalf(`invoking "go tool vet" directly is unsupported; use "go vet"`)
	}
	Run(args[0], analyzers)
}
// Main is the main function of a vet-like analysis tool that must be
// invoked by a build system to analyze a single package.
//
// The protocol required by 'go vet -vettool=...' is that the tool must support:
//
//      -flags          describe flags in JSON
//      -V=full         describe executable for build caching
//      foo.cfg         perform separate modular analyze on the single
//                      unit described by a JSON config file foo.cfg.
//
Main is the main function of a vet-like analysis tool that must be
invoked by a build system to analyze a single package.

The protocol required by 'go vet -vettool=...' is that the tool must support.

-flags          describe flags in JSON
-V=full         describe executable for build caching
foo.cfg         perform separate modular analyze on the single
unit described by a JSON config file foo.cfg.
// Main is the main function of a vet - like analysis tool that must be // invoked by a build system to analyze a single package . // // The protocol required by ' go vet - vettool = ... ' is that the tool must support : // // - flags describe flags in JSON // - V = full describe executable for build caching // foo . cfg perform separate modular analyze on the single // unit described by a JSON config file foo . cfg . //
func Main(analyzers ...*analysis.Analyzer) {
	progname := filepath.Base(os.Args[0])
	log.SetFlags(0)
	log.SetPrefix(progname + ": ")
	if err := analysis.Validate(analyzers); err != nil {
		log.Fatal(err)
	}
	flag.Usage = func() {
		fmt.Fprintf(os.Stderr, `%[1]s is a tool for static analysis of Go programs.
Usage of %[1]s:
	%.16[1]s unit.cfg	# execute analysis specified by config file
	%.16[1]s help    	# general help
	%.16[1]s help name	# help on specific analyzer and its flags
`, progname)
		os.Exit(1)
	}
	analyzers = analysisflags.Parse(analyzers, true)
	args := flag.Args()
	if len(args) == 0 {
		flag.Usage()
	}
	if args[0] == "help" {
		analysisflags.Help(progname, analyzers, args[1:])
		os.Exit(0)
	}
	if len(args) != 1 || !strings.HasSuffix(args[0], ".cfg") {
		log.Fatalf(`invoking "go tool vet" directly is unsupported; use "go vet"`)
	}
	Run(args[0], analyzers)
}
func Main ( analyzers ... * analysis . Analyzer ) { progname := filepath . Base ( os . Args [ 0 ] ) log . SetFlags ( 0 ) log . SetPrefix ( progname + " " ) if err := analysis . Validate ( analyzers ) ; err != nil { log . Fatal ( err ) } flag . Usage = func ( ) { fmt . Fprintf ( os . Stderr , `%[1]s is a tool for static analysis of Go programs.

Usage of %[1]s:
	%.16[1]s unit.cfg	# execute analysis specified by config file
	%.16[1]s help    	# general help
	%.16[1]s help name	# help on specific analyzer and its flags
` , progname ) os . Exit ( 1 ) } analyzers = analysisflags . Parse ( analyzers , true ) args := flag . Args ( ) if len ( args ) == 0 { flag . Usage ( ) } if args [ 0 ] == " " { analysisflags . Help ( progname , analyzers , args [ 1 : ] ) os . Exit ( 0 ) } if len ( args ) != 1 || ! strings . HasSuffix ( args [ 0 ] , " " ) { log . Fatalf ( `invoking "go tool vet" directly is unsupported; use "go vet"` ) } Run ( args [ 0 ] , analyzers ) }
Main is the main function of a vet-like analysis tool that must be
invoked by a build system to analyze a single package.
Main is the main function of a vet - like analysis tool that must be invoked by a build system to analyze a single package .