github.com/pankona/gometalinter@v2.0.11+incompatible/_linters/src/mvdan.cc/unparam/main.go (about)

     1  // Copyright (c) 2017, Daniel Martí <mvdan@mvdan.cc>
     2  // See LICENSE for licensing information
     3  
     4  package main // import "mvdan.cc/unparam"
     5  
     6  import (
     7  	"flag"
     8  	"fmt"
     9  	"os"
    10  
    11  	"mvdan.cc/unparam/check"
    12  )
    13  
    14  var (
    15  	tests = flag.Bool("tests", true, "include tests")
    16  	debug = flag.Bool("debug", false, "debug prints")
    17  )
    18  
    19  func main() {
    20  	flag.Usage = func() {
    21  		fmt.Fprintln(os.Stderr, "usage: unparam [flags] [package ...]")
    22  		flag.PrintDefaults()
    23  	}
    24  	flag.Parse()
    25  	warns, err := check.UnusedParams(*tests, *debug, flag.Args()...)
    26  	if err != nil {
    27  		fmt.Fprintln(os.Stderr, err)
    28  		os.Exit(1)
    29  	}
    30  	for _, warn := range warns {
    31  		fmt.Println(warn)
    32  	}
    33  }