github.com/TNTworks/flogo-cli@v0.9.1-0.20220522183836-60b8a963ae00/cmd/flogo/gen/version.go (about)

     1  // +build ignore
     2  
     3  package main
     4  
     5  import (
     6  	"github.com/TNTworks/flogo-cli/util"
     7  	"os"
     8  )
     9  
    10  // This Go program is aimed at being called by go:generate from "cmd/flogo/main.go" to create a "currentversion.go" file
    11  // in the "cmd/flogo" subdirectory.
    12  //
    13  // Once this file is created, it will set at runtime the version of the CLI without relying on GOPATH nor Git command to
    14  // parse the version from the source. Hence it is possible to distribute the CLI as a fully static binary.
    15  //
    16  // Users getting the CLI with a classic "go get" command will still have the version retrieved from the directory
    17  // $GOPATH/src/github.com/TNTworks/flogo-cli
    18  func main() {
    19  
    20  	_, currentVersion, _ := util.GetCLIInfo()
    21  	wd, err := os.Getwd()
    22  	if err != nil {
    23  		return
    24  	}
    25  
    26  	util.CreateVersionFile(wd, currentVersion)
    27  }