10666: Added version number to go sdk and go tools & services
[arvados.git] / tools / keep-block-check / keep-block-check.go
index 7dca3293d25fce94111eb1708fde156fc5c52387..9d3b45a6bd988a20f01838dfa8b176098152c7f9 100644 (file)
@@ -18,6 +18,7 @@ import (
 
        "git.curoverse.com/arvados.git/sdk/go/arvadosclient"
        "git.curoverse.com/arvados.git/sdk/go/keepclient"
+       arvadosVersion "git.curoverse.com/arvados.git/sdk/go/version"
 )
 
 func main() {
@@ -62,9 +63,20 @@ func doMain(args []string) error {
                false,
                "Log progress of each block verification")
 
+       getVersion := flags.Bool(
+               "version",
+               false,
+               "Print version information and exit.")
+
        // Parse args; omit the first arg which is the command name
        flags.Parse(args)
 
+       // Print version information if requested
+       if *getVersion {
+               fmt.Printf("Version: %s\n", arvadosVersion.GetVersion())
+               os.Exit(0)
+       }
+
        config, blobSigningKey, err := loadConfig(*configFile)
        if err != nil {
                return fmt.Errorf("Error loading configuration from file: %s", err.Error())