github.com/ungtb10d/cli/v2@v2.0.0-20221110210412-98537dd9d6a1/internal/build/build.go (about)

     1  package build
     2  
     3  import (
     4  	"runtime/debug"
     5  )
     6  
     7  // Version is dynamically set by the toolchain or overridden by the Makefile.
     8  var Version = "DEV"
     9  
    10  // Date is dynamically set at build time in the Makefile.
    11  var Date = "" // YYYY-MM-DD
    12  
    13  func init() {
    14  	if Version == "DEV" {
    15  		if info, ok := debug.ReadBuildInfo(); ok && info.Main.Version != "(devel)" {
    16  			Version = info.Main.Version
    17  		}
    18  	}
    19  }