Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
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
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
005da75f
Commit
005da75f
authored
Apr 01, 2015
by
Tim Hockin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make the build faster - call 'go install' once
parent
fb1a8219
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
12 deletions
+24
-12
golang.sh
hack/lib/golang.sh
+24
-12
No files found.
hack/lib/golang.sh
View file @
005da75f
...
@@ -312,13 +312,26 @@ kube::golang::build_binaries() {
...
@@ -312,13 +312,26 @@ kube::golang::build_binaries() {
local
binaries
local
binaries
binaries
=(
$(
kube::golang::binaries_from_targets
"
${
targets
[@]
}
"
)
)
binaries
=(
$(
kube::golang::binaries_from_targets
"
${
targets
[@]
}
"
)
)
local
platform
local
platform
for
platform
in
"
${
platforms
[@]
}
"
;
do
for
platform
in
"
${
platforms
[@]
}
"
;
do
kube::golang::set_platform_envs
"
${
platform
}
"
kube::golang::set_platform_envs
"
${
platform
}
"
kube::log::status
"Building go targets for
${
platform
}
:"
"
${
targets
[@]
}
"
kube::log::status
"Building go targets for
${
platform
}
:"
"
${
targets
[@]
}
"
local
-a
statics
=()
local
-a
nonstatics
=()
for
binary
in
"
${
binaries
[@]
}
"
;
do
if
kube::golang::is_statically_linked_library
"
${
binary
}
"
;
then
kube::golang::exit_if_stdlib_not_installed
;
statics+
=(
$binary
)
else
nonstatics+
=(
$binary
)
fi
done
if
[[
-n
${
use_go_build
:-}
]]
;
then
if
[[
-n
${
use_go_build
:-}
]]
;
then
# Try and replicate the native binary placement of go install without calling go install
# Try and replicate the native binary placement of go install without
# calling go install. This means we have to iterate each binary.
local
output_path
=
"
${
KUBE_GOPATH
}
/bin"
local
output_path
=
"
${
KUBE_GOPATH
}
/bin"
if
[[
$platform
!=
$host_platform
]]
;
then
if
[[
$platform
!=
$host_platform
]]
;
then
output_path
=
"
${
output_path
}
/
${
platform
//\//_
}
"
output_path
=
"
${
output_path
}
/
${
platform
//\//_
}
"
...
@@ -329,7 +342,7 @@ kube::golang::build_binaries() {
...
@@ -329,7 +342,7 @@ kube::golang::build_binaries() {
if
[[
${
GOOS
}
==
"windows"
]]
;
then
if
[[
${
GOOS
}
==
"windows"
]]
;
then
bin
=
"
${
bin
}
.exe"
bin
=
"
${
bin
}
.exe"
fi
fi
if
kube::golang::is_statically_linked_library
"
${
binary
}
"
;
then
if
kube::golang::is_statically_linked_library
"
${
binary
}
"
;
then
kube::golang::exit_if_stdlib_not_installed
;
kube::golang::exit_if_stdlib_not_installed
;
CGO_ENABLED
=
0 go build
-installsuffix
cgo
-o
"
${
output_path
}
/
${
bin
}
"
\
CGO_ENABLED
=
0 go build
-installsuffix
cgo
-o
"
${
output_path
}
/
${
bin
}
"
\
...
@@ -344,18 +357,17 @@ kube::golang::build_binaries() {
...
@@ -344,18 +357,17 @@ kube::golang::build_binaries() {
fi
fi
done
done
else
else
for
binary
in
"
${
binaries
[@]
}
"
;
do
# Use go install.
if
kube::golang::is_statically_linked_library
"
${
binary
}
"
;
then
if
[[
"
${#
nonstatics
[@]
}
"
!=
0
]]
;
then
kube::golang::exit_if_stdlib_not_installed
;
CGO_ENABLED
=
0 go
install
-installsuffix
cgo
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-ldflags
"
${
version_ldflags
}
"
\
"
${
binary
}
"
else
go
install
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
go
install
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-ldflags
"
${
version_ldflags
}
"
\
"
${
nonstatics
[@]
:+
${
nonstatics
[@]
}}
"
fi
if
[[
"
${#
statics
[@]
}
"
!=
0
]]
;
then
CGO_ENABLED
=
0 go
install
-installsuffix
cgo
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-ldflags
"
${
version_ldflags
}
"
\
-ldflags
"
${
version_ldflags
}
"
\
"
${
binary
}
"
"
${
statics
[@]
:+
${
statics
[@]
}
}
"
fi
fi
done
fi
fi
done
done
)
)
...
...
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