mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-17 09:23:48 +00:00
build: fix version comparison for Go 1.10+
This commit is contained in:
parent
b9731767af
commit
0f8a25b967
1 changed files with 11 additions and 5 deletions
|
|
@ -179,12 +179,18 @@ func doInstall(cmdline []string) {
|
||||||
|
|
||||||
// Check Go version. People regularly open issues about compilation
|
// Check Go version. People regularly open issues about compilation
|
||||||
// failure with outdated Go. This should save them the trouble.
|
// failure with outdated Go. This should save them the trouble.
|
||||||
if runtime.Version() < "go1.7" && !strings.Contains(runtime.Version(), "devel") {
|
if !strings.Contains(runtime.Version(), "devel") {
|
||||||
|
// Figure out the minor version number since we can't textually compare (1.10 < 1.7)
|
||||||
|
var minor int
|
||||||
|
fmt.Sscanf(strings.TrimPrefix(runtime.Version(), "go1."), "%d", &minor)
|
||||||
|
|
||||||
|
if minor < 7 {
|
||||||
log.Println("You have Go version", runtime.Version())
|
log.Println("You have Go version", runtime.Version())
|
||||||
log.Println("go-ethereum requires at least Go version 1.7 and cannot")
|
log.Println("go-ethereum requires at least Go version 1.7 and cannot")
|
||||||
log.Println("be compiled with an earlier version. Please upgrade your Go installation.")
|
log.Println("be compiled with an earlier version. Please upgrade your Go installation.")
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// Compile packages given as arguments, or everything if there are no arguments.
|
// Compile packages given as arguments, or everything if there are no arguments.
|
||||||
packages := []string{"./..."}
|
packages := []string{"./..."}
|
||||||
if flag.NArg() > 0 {
|
if flag.NArg() > 0 {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue