delve/pkg/goversion/compat.go
Alessandro Arzilli 55eed318fd Go 1.13 support (#1546)
* tests: fix tests for Go 1.13

- Go 1.13 doesn't autogenerate init functions anymore, tests that
  expected that now fail and should be skipped.
- Plugin tests now need -gcflags'all=-N -l' now, we were probably
  getting lucky with -gcflags='-N -l' before.

* proc: allow signed integers as shift counts

Go1.13 allows signed integers to be used as the right hand side of a
shift operator, change eval to match.

* goversion: update maximum supported version

* travis: force Go to use vendor directory

Travis scripts get confused by "go: downloading" lines, the exact
reason is not clear. Testing that the vendor directory is up to date is
a good idea anyway.
2019-06-30 10:34:47 -07:00

29 lines
994 B
Go

package goversion
import (
"fmt"
)
var (
minSupportedVersionOfGoMinor = 10
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)
)
// Compatible checks that the version specified in the producer string is compatible with
// this version of delve.
func Compatible(producer string) error {
ver := parseProducer(producer)
if ver.IsDevel() {
return nil
}
if !ver.AfterOrEqual(GoVersion{1, minSupportedVersionOfGoMinor, -1, 0, 0, ""}) {
return goTooOldErr
}
if ver.AfterOrEqual(GoVersion{1, maxSupportedVersionOfGoMinor + 1, -1, 0, 0, ""}) {
return dlvTooOldErr
}
return nil
}