github.com/cnboonhan/delve@v0.0.0-20230908061759-363f2388c2fb/pkg/version/version.go (about) 1 package version 2 3 import ( 4 "fmt" 5 "runtime" 6 ) 7 8 // Version represents the current version of Delve. 9 type Version struct { 10 Major string 11 Minor string 12 Patch string 13 Metadata string 14 Build string 15 } 16 17 var ( 18 // DelveVersion is the current version of Delve. 19 DelveVersion = Version{ 20 Major: "1", Minor: "21", Patch: "0", Metadata: "", 21 Build: "$Id: fec0d226b2c2cce1567d5f59169660cf61dc1efe $", 22 } 23 ) 24 25 func (v Version) String() string { 26 fixBuild(&v) 27 ver := fmt.Sprintf("Version: %s.%s.%s", v.Major, v.Minor, v.Patch) 28 if v.Metadata != "" { 29 ver += "-" + v.Metadata 30 } 31 return fmt.Sprintf("%s\nBuild: %s", ver, v.Build) 32 } 33 34 var buildInfo = func() string { 35 return "" 36 } 37 38 func BuildInfo() string { 39 return fmt.Sprintf("%s\n%s", runtime.Version(), buildInfo()) 40 } 41 42 var fixBuild = func(v *Version) { 43 // does nothing 44 }