mirror of
https://github.com/securego/gosec.git
synced 2024-12-25 12:05:52 +00:00
print version string (#317)
Signed-off-by: Sandor Szücs <sandor.szuecs@zalando.de>
This commit is contained in:
parent
ee80733faf
commit
9d9098fa97
1 changed files with 8 additions and 0 deletions
|
@ -104,6 +104,9 @@ var (
|
||||||
// scan tests files
|
// scan tests files
|
||||||
flagScanTests = flag.Bool("tests", false, "Scan tests files")
|
flagScanTests = flag.Bool("tests", false, "Scan tests files")
|
||||||
|
|
||||||
|
// print version and quit with exit code 0
|
||||||
|
flagVersion = flag.Bool("version", false, "Print version and quit with exit code 0")
|
||||||
|
|
||||||
logger *log.Logger
|
logger *log.Logger
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -219,6 +222,11 @@ func main() {
|
||||||
// Parse command line arguments
|
// Parse command line arguments
|
||||||
flag.Parse()
|
flag.Parse()
|
||||||
|
|
||||||
|
if *flagVersion {
|
||||||
|
fmt.Printf("Version: %s\nGit tag: %s\nBuild date: %s\n", Version, GitTag, BuildDate)
|
||||||
|
os.Exit(0)
|
||||||
|
}
|
||||||
|
|
||||||
// Ensure at least one file was specified
|
// Ensure at least one file was specified
|
||||||
if flag.NArg() == 0 {
|
if flag.NArg() == 0 {
|
||||||
fmt.Fprintf(os.Stderr, "\nError: FILE [FILE...] or './...' expected\n") // #nosec
|
fmt.Fprintf(os.Stderr, "\nError: FILE [FILE...] or './...' expected\n") // #nosec
|
||||||
|
|
Loading…
Reference in a new issue