@@ -176,11 +176,17 @@ func doInstall(cmdline []string) {
176176
177177 // Check Go version. People regularly open issues about compilation
178178 // failure with outdated Go. This should save them the trouble.
179- if runtime .Version () < "go1.7" && ! strings .Contains (runtime .Version (), "devel" ) {
180- log .Println ("You have Go version" , runtime .Version ())
181- log .Println ("go-ethereum requires at least Go version 1.7 and cannot" )
182- log .Println ("be compiled with an earlier version. Please upgrade your Go installation." )
183- os .Exit (1 )
179+ if ! strings .Contains (runtime .Version (), "devel" ) {
180+ // Figure out the minor version number since we can't textually compare (1.10 < 1.7)
181+ var minor int
182+ fmt .Sscanf (strings .TrimPrefix (runtime .Version (), "go1." ), "%d" , & minor )
183+
184+ if minor < 7 {
185+ log .Println ("You have Go version" , runtime .Version ())
186+ log .Println ("go-ethereum requires at least Go version 1.7 and cannot" )
187+ log .Println ("be compiled with an earlier version. Please upgrade your Go installation." )
188+ os .Exit (1 )
189+ }
184190 }
185191 // Compile packages given as arguments, or everything if there are no arguments.
186192 packages := []string {"./..." }
@@ -254,7 +260,10 @@ func goToolArch(arch string, subcmd string, args ...string) *exec.Cmd {
254260 if subcmd == "build" || subcmd == "install" || subcmd == "test" {
255261 // Go CGO has a Windows linker error prior to 1.8 (https://github.com/golang/go/issues/8756).
256262 // Work around issue by allowing multiple definitions for <1.8 builds.
257- if runtime .GOOS == "windows" && runtime .Version () < "go1.8" {
263+ var minor int
264+ fmt .Sscanf (strings .TrimPrefix (runtime .Version (), "go1." ), "%d" , & minor )
265+
266+ if runtime .GOOS == "windows" && minor < 8 {
258267 cmd .Args = append (cmd .Args , []string {"-ldflags" , "-extldflags -Wl,--allow-multiple-definition" }... )
259268 }
260269 }
0 commit comments