diff --git a/pkg/goversion/compat.go b/pkg/goversion/compat.go index 4d96a1d2c3f61fe4050cd282a0bcd359ccef4865..d0bcac4b434a5a3b35bdef40c10ff2af09dee2d1 100644 --- a/pkg/goversion/compat.go +++ b/pkg/goversion/compat.go @@ -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 diff --git a/service/api/types.go b/service/api/types.go index e532e66eab7d448fd61844b797cc0a16e33d75dd..3037d78e3f0a58539b02bb290bc0f319c1ccbb47 100644 --- a/service/api/types.go +++ b/service/api/types.go @@ -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. diff --git a/service/debugger/debugger.go b/service/debugger/debugger.go index 4ac997eb809b7c7c8470a0425fed9f96b07dfe40..541053aa74403c853230f7d05222942f3480bff2 100644 --- a/service/debugger/debugger.go +++ b/service/debugger/debugger.go @@ -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 }