diff options
| -rw-r--r-- | capturedrefrace.go | 2 | ||||
| -rw-r--r-- | cmd/gocapturedrefrace/main.go | 13 | 
2 files changed, 12 insertions, 3 deletions
| diff --git a/capturedrefrace.go b/capturedrefrace.go index 21a8b2d..b58ed9d 100644 --- a/capturedrefrace.go +++ b/capturedrefrace.go @@ -29,8 +29,6 @@ import (  	"golang.org/x/tools/go/ast/inspector"  ) -var version = "0.0.1" -  var Analyzer = &analysis.Analyzer{  	Name:     "capturedrefrace",  	Doc:      "reports captured references in goroutine closures", diff --git a/cmd/gocapturedrefrace/main.go b/cmd/gocapturedrefrace/main.go index 60c7838..5a8970b 100644 --- a/cmd/gocapturedrefrace/main.go +++ b/cmd/gocapturedrefrace/main.go @@ -16,14 +16,25 @@  // along with Gocapturedrefrace. If not, see  // <https://www.gnu.org/licenses/>. -  package main  import ( +	"os" +  	"golang.org/x/tools/go/analysis/singlechecker"  	"gopkg.teddywing.com/capturedrefrace"  ) +var version = "0.0.1" +  func main() { +	if len(os.Args) > 1 && +		(os.Args[1] == "-V" || +			os.Args[1] == "--version") { + +		println(version) +		os.Exit(0) +	} +  	singlechecker.Main(capturedrefrace.Analyzer)  } | 
