good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
2fe07c20
Commit
2fe07c20
authored
Jan 2, 2018
by
Péter Szilágyi
Committed by
Felix Lange
Jan 2, 2018
Browse files
Options
Downloads
Patches
Plain Diff
build: fix version comparison for go1.10 and beyond (#15781)
parent
6882943e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
build/ci.go
+15
-6
15 additions, 6 deletions
build/ci.go
with
15 additions
and
6 deletions
build/ci.go
+
15
−
6
View file @
2fe07c20
...
...
@@ -179,12 +179,18 @@ 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"
)
{
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
{
"./..."
}
if
flag
.
NArg
()
>
0
{
...
...
@@ -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.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment