version.go raw

   1  package version
   2  
   3  //go:generate go run ./update/.
   4  
   5  import (
   6  	"fmt"
   7  )
   8  
   9  var (
  10  
  11  	// URL is the git URL for the repository
  12  	URL = "github.com/p9c/gel"
  13  	// GitRef is the gitref, as in refs/heads/branchname
  14  	GitRef = "refs/heads/main"
  15  	// GitCommit is the commit hash of the current HEAD
  16  	GitCommit = "92b237c25172b30af617ca4595645187605ff411"
  17  	// BuildTime stores the time when the current binary was built
  18  	BuildTime = "2021-04-30T21:01:32+02:00"
  19  	// Tag lists the Tag on the build, adding a + to the newest Tag if the commit is
  20  	// not that commit
  21  	Tag = "v0.1.25+"
  22  	// PathBase is the path base returned from runtime caller
  23  	PathBase = "/home/loki/src/github.com/p9c/pod/pkg/gel/"
  24  	// Major is the major number from the tag
  25  	Major = 0
  26  	// Minor is the minor number from the tag
  27  	Minor = 1
  28  	// Patch is the patch version number from the tag
  29  	Patch = 25
  30  	// Meta is the extra arbitrary string field from Semver spec
  31  	Meta = ""
  32  )
  33  
  34  // Get returns a pretty printed version information string
  35  func Get() string {
  36  	return fmt.Sprint(
  37  		"\nRepository Information\n"+
  38  		"\tGit repository: "+URL+"\n",
  39  		"\tBranch: "+GitRef+"\n"+
  40  		"\tCommit: "+GitCommit+"\n"+
  41  		"\tBuilt: "+BuildTime+"\n"+
  42  		"\tTag: "+Tag+"\n",
  43  		"\tMajor:", Major, "\n",
  44  		"\tMinor:", Minor, "\n",
  45  		"\tPatch:", Patch, "\n",
  46  		"\tMeta: ", Meta, "\n",
  47  	)
  48  }
  49