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
27ec6c90
Commit
27ec6c90
authored
Mar 31, 2015
by
Victor Marmol
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #6205 from ArtfulCoder/cgo_error_msg
Nicer error msg if stdlib pkg with cgo flag is not installed
parents
372494b5
745368d6
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 @
27ec6c90
...
...
@@ -242,6 +242,27 @@ kube::golang::place_bins() {
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
#
# Input:
...
...
@@ -310,6 +331,7 @@ kube::golang::build_binaries() {
fi
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
}
"
\
"
${
goflags
[@]
:+
${
goflags
[@]
}}
"
\
-ldflags
"
${
version_ldflags
}
"
\
...
...
@@ -324,6 +346,7 @@ kube::golang::build_binaries() {
else
for
binary
in
"
${
binaries
[@]
}
"
;
do
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
[@]
}}
"
\
-ldflags
"
${
version_ldflags
}
"
\
"
${
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