github.com/olivere/camlistore@v0.0.0-20140121221811-1b7ac2da0199/pkg/buildinfo/buildinfo.go (about)

     1  // Package buildinfo provides information about the current build.
     2  package buildinfo
     3  
     4  // GitInfo is either the empty string (the default)
     5  // or is set to the git hash of the most recent commit
     6  // using the -X linker flag. For example, it's set like:
     7  // $ go install --ldflags="-X camlistore.org/pkg/buildinfo.GitInfo "`./misc/gitversion` camlistore.org/server/camlistored
     8  var GitInfo string
     9  
    10  // Version returns the git version of this binary.
    11  // If the linker flags were not provided, the return value is "unknown".
    12  func Version() string {
    13  	if GitInfo != "" {
    14  		return GitInfo
    15  	}
    16  	return "unknown"
    17  }