From fcd96dd6cb8eb5cca6c18972c406ad966669fe91 Mon Sep 17 00:00:00 2001 From: AnanevVN Date: Mon, 14 Feb 2022 11:32:21 +0300 Subject: [PATCH] feat: version flag added --- go.mod | 2 -- go.sum | 2 -- main.go | 14 +++++++++++++- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 3e6cc63..53f2dd8 100644 --- a/go.mod +++ b/go.mod @@ -2,8 +2,6 @@ module github.com/vseinstrumentiru/protoc-gen-go-kafka go 1.17 -require github.com/pkg/errors v0.9.1 - require ( github.com/stretchr/testify v1.7.0 google.golang.org/protobuf v1.26.0 diff --git a/go.sum b/go.sum index 3c44405..cc352a6 100644 --- a/go.sum +++ b/go.sum @@ -3,8 +3,6 @@ github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSs github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= -github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= diff --git a/main.go b/main.go index 4fce950..aafbadf 100644 --- a/main.go +++ b/main.go @@ -21,9 +21,21 @@ type gen struct { PathFile string } -const defaultSuffix = "Export" +const ( + defaultSuffix = "Export" + version = "v1.1.1" +) func main() { + versionFlag := flag.Bool("version", false, "print version and exit") + flag.Parse() + + if *versionFlag { + fmt.Println(version) + + return + } + var flags flag.FlagSet suffix := flags.String("suffix", defaultSuffix, "") protoc := protogen.Options{