Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
2fe07c20
Commit
2fe07c20
authored
7 years ago
by
Péter Szilágyi
Committed by
Felix Lange
7 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
build: fix version comparison for go1.10 and beyond (#15781)
parent
6882943e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
6 deletions
+15
-6
ci.go
build/ci.go
+15
-6
No files found.
build/ci.go
View file @
2fe07c20
...
...
@@ -179,11 +179,17 @@ func doInstall(cmdline []string) {
// Check Go version. People regularly open issues about compilation
// failure with outdated Go. This should save them the trouble.
if
runtime
.
Version
()
<
"go1.7"
&&
!
strings
.
Contains
(
runtime
.
Version
(),
"devel"
)
{
log
.
Println
(
"You have Go version"
,
runtime
.
Version
())
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."
)
os
.
Exit
(
1
)
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
(
"go-ethereum requires at least Go version 1.7 and cannot"
)
log
.
Println
(
"be compiled with an earlier version. Please upgrade your Go installation."
)
os
.
Exit
(
1
)
}
}
// Compile packages given as arguments, or everything if there are no arguments.
packages
:=
[]
string
{
"./..."
}
...
...
@@ -257,7 +263,10 @@ func goToolArch(arch string, subcmd string, args ...string) *exec.Cmd {
if
subcmd
==
"build"
||
subcmd
==
"install"
||
subcmd
==
"test"
{
// Go CGO has a Windows linker error prior to 1.8 (https://github.com/golang/go/issues/8756).
// Work around issue by allowing multiple definitions for <1.8 builds.
if
runtime
.
GOOS
==
"windows"
&&
runtime
.
Version
()
<
"go1.8"
{
var
minor
int
fmt
.
Sscanf
(
strings
.
TrimPrefix
(
runtime
.
Version
(),
"go1."
),
"%d"
,
&
minor
)
if
runtime
.
GOOS
==
"windows"
&&
minor
<
8
{
cmd
.
Args
=
append
(
cmd
.
Args
,
[]
string
{
"-ldflags"
,
"-extldflags -Wl,--allow-multiple-definition"
}
...
)
}
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment