delve/pkg/version/version.go

41 lines
787 B
Go
Raw Normal View History

package version
import (
"fmt"
"runtime"
)
// Version represents the current version of Delve.
type Version struct {
Major string
Minor string
Patch string
Metadata string
Build string
}
var (
// DelveVersion is the current version of Delve.
DelveVersion = Version{
2021-11-17 15:33:11 +00:00
Major: "1", Minor: "7", Patch: "3", Metadata: "",
//TODO(aarzilli): before updating this to 1.8.0 re-enable staticcheck test
Build: "$Id$",
}
)
func (v Version) String() string {
2017-01-11 19:34:54 +00:00
ver := fmt.Sprintf("Version: %s.%s.%s", v.Major, v.Minor, v.Patch)
if v.Metadata != "" {
ver += "-" + v.Metadata
}
return fmt.Sprintf("%s\nBuild: %s", ver, v.Build)
}
var buildInfo = func() string {
return ""
}
func BuildInfo() string {
return fmt.Sprintf("%s\n%s", runtime.Version(), buildInfo())
}