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
745368d6
Commit
745368d6
authored
Mar 30, 2015
by
Abhishek Shah
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Nicer error msg if stdlib pkg with cgo flag is not installed
parent
9ed87612
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
+23
-0
golang.sh
hack/lib/golang.sh
+23
-0
No files found.
hack/lib/golang.sh
View file @
745368d6
...
@@ -242,6 +242,27 @@ kube::golang::place_bins() {
...
@@ -242,6 +242,27 @@ kube::golang::place_bins() {
done
done
}
}
kube::golang::exit_if_stdlib_not_installed
()
{
local
go_root_dir
=
$(
go
env
GOROOT
)
;
local
go_host_os
=
$(
go
env
GOHOSTOS
)
;
local
go_host_arch
=
$(
go
env
GOHOSTARCH
)
;
local
cgo_pkg_dir
=
${
go_root_dir
}
/pkg/
${
go_host_os
}
_
${
go_host_arch
}
_cgo
;
if
[
-e
${
cgo_pkg_dir
}
]
;
then
return
0
;
fi
if
[
-w
${
go_root_dir
}
/pkg
]
;
then
return
0
;
fi
kube::log::status
"+++ Error. stdlib pkg with cgo flag not found."
;
kube::log::status
"+++ Error. stdlib pkg cannot be rebuilt since
${
go_root_dir
}
/pkg is not writable by
`
whoami
`
"
;
kube::log::status
"+++ Error. Make
${
go_root_dir
}
/pkg writable for
`
whoami
`
for a one-time stdlib install, Or"
kube::log::status
"+++ Error. Rebuild stdlib using the command 'CGO_ENABLED=0 go install -a installsuffix cgo std'"
;
exit
0
;
}
# Build binaries targets specified
# Build binaries targets specified
#
#
# Input:
# Input:
...
@@ -310,6 +331,7 @@ kube::golang::build_binaries() {
...
@@ -310,6 +331,7 @@ kube::golang::build_binaries() {
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
;
CGO_ENABLED
=
0 go build
-installsuffix
cgo
-o
"
${
output_path
}
/
${
bin
}
"
\
CGO_ENABLED
=
0 go build
-installsuffix
cgo
-o
"
${
output_path
}
/
${
bin
}
"
\
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-ldflags
"
${
version_ldflags
}
"
\
-ldflags
"
${
version_ldflags
}
"
\
...
@@ -324,6 +346,7 @@ kube::golang::build_binaries() {
...
@@ -324,6 +346,7 @@ kube::golang::build_binaries() {
else
else
for
binary
in
"
${
binaries
[@]
}
"
;
do
for
binary
in
"
${
binaries
[@]
}
"
;
do
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
;
CGO_ENABLED
=
0 go
install
-installsuffix
cgo
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
CGO_ENABLED
=
0 go
install
-installsuffix
cgo
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-ldflags
"
${
version_ldflags
}
"
\
-ldflags
"
${
version_ldflags
}
"
\
"
${
binary
}
"
"
${
binary
}
"
...
...
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