提交 d064d1fe 编写于 作者: A Alessandro Arzilli 提交者: Derek Parker

service: add min/max supported ver and target ver to GetVersion resp (#1718)

Fixes #1713
上级 6c8c4508
......@@ -5,10 +5,12 @@ import (
)
var (
minSupportedVersionOfGoMinor = 11
maxSupportedVersionOfGoMinor = 13
goTooOldErr = fmt.Errorf("Version of Go is too old for this version of Delve (minimum supported version 1.%d, suppress this error with --check-go-version=false)", minSupportedVersionOfGoMinor)
dlvTooOldErr = fmt.Errorf("Version of Delve is too old for this version of Go (maximum supported version 1.%d, suppress this error with --check-go-version=false)", maxSupportedVersionOfGoMinor)
MinSupportedVersionOfGoMajor = 1
MinSupportedVersionOfGoMinor = 11
MaxSupportedVersionOfGoMajor = 1
MaxSupportedVersionOfGoMinor = 13
goTooOldErr = fmt.Errorf("Version of Go is too old for this version of Delve (minimum supported version %d.%d, suppress this error with --check-go-version=false)", MinSupportedVersionOfGoMajor, MinSupportedVersionOfGoMinor)
dlvTooOldErr = fmt.Errorf("Version of Delve is too old for this version of Go (maximum supported version %d.%d, suppress this error with --check-go-version=false)", MaxSupportedVersionOfGoMajor, MaxSupportedVersionOfGoMinor)
)
// Compatible checks that the version specified in the producer string is compatible with
......@@ -18,10 +20,10 @@ func Compatible(producer string) error {
if ver.IsDevel() {
return nil
}
if !ver.AfterOrEqual(GoVersion{1, minSupportedVersionOfGoMinor, -1, 0, 0, ""}) {
if !ver.AfterOrEqual(GoVersion{MinSupportedVersionOfGoMajor, MinSupportedVersionOfGoMinor, -1, 0, 0, ""}) {
return goTooOldErr
}
if ver.AfterOrEqual(GoVersion{1, maxSupportedVersionOfGoMinor + 1, -1, 0, 0, ""}) {
if ver.AfterOrEqual(GoVersion{MaxSupportedVersionOfGoMajor, MaxSupportedVersionOfGoMinor + 1, -1, 0, 0, ""}) {
return dlvTooOldErr
}
return nil
......
......@@ -413,9 +413,13 @@ type GetVersionIn struct {
// GetVersionOut is the result of GetVersion.
type GetVersionOut struct {
DelveVersion string
APIVersion int
Backend string // backend currently in use
DelveVersion string
APIVersion int
Backend string // backend currently in use
TargetGoVersion string
MinSupportedVersionOfGo string
MaxSupportedVersionOfGo string
}
// SetAPIVersionIn is the input for SetAPIVersion.
......
......@@ -1280,6 +1280,12 @@ func (d *Debugger) GetVersion(out *api.GetVersionOut) error {
out.Backend = d.config.Backend
}
}
out.TargetGoVersion = d.target.BinInfo().Producer()
out.MinSupportedVersionOfGo = fmt.Sprintf("%d.%d.0", goversion.MinSupportedVersionOfGoMajor, goversion.MinSupportedVersionOfGoMinor)
out.MaxSupportedVersionOfGo = fmt.Sprintf("%d.%d.0", goversion.MaxSupportedVersionOfGoMajor, goversion.MaxSupportedVersionOfGoMinor)
return nil
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册