github.com/neilgarb/delve@v1.9.2-nobreaks/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: "9", Patch: "0", Metadata: "",
    21  		//TODO(aarzilli): before updating this to 1.8.0 re-enable staticcheck test
    22  		Build: "$Id: 69310c2f438e492f892d6af22e8e62c8ea1e9d8d $",
    23  	}
    24  )
    25  
    26  func (v Version) String() string {
    27  	fixBuild(&v)
    28  	ver := fmt.Sprintf("Version: %s.%s.%s", v.Major, v.Minor, v.Patch)
    29  	if v.Metadata != "" {
    30  		ver += "-" + v.Metadata
    31  	}
    32  	return fmt.Sprintf("%s\nBuild: %s", ver, v.Build)
    33  }
    34  
    35  var buildInfo = func() string {
    36  	return ""
    37  }
    38  
    39  func BuildInfo() string {
    40  	return fmt.Sprintf("%s\n%s", runtime.Version(), buildInfo())
    41  }
    42  
    43  var fixBuild = func(v *Version) {
    44  	// does nothing
    45  }