Issue 1:
Doing a make in the kubernetes source tree produces this error when building with a system version of go:

go install runtime: mkdir /usr/lib/golang/pkg/linux_amd64_cgo/: permission denied

The build shouldn't be trying to install into system directories. The error is traced is this line:

'CGO_ENABLED=0 go install -installsuffix cgo "${goflags[@]:+${goflags[@]}}" -ldflags "${version_ldflags}" "${binary}"' exited with status 1

Which seems to have come from commit 9a901ed.

Issue 2:
On my system (Fedora 21), I'm now unable to successfully build master. I get permission denied errors trying to write to /usr/lib/golang/pkg/linux_amd64_cgo/.

$ ./hack/build-go.sh cmd/kube-apiserver
cmd/kube-apiserver
go install runtime: mkdir /usr/lib/golang/pkg/linux_amd64_cgo/: permission denied
!!! Error in /home/vagrant/go/src/github.com/GoogleCloudPlatform/kubernetes/hack/lib/golang.sh:328
'CGO_ENABLED=0 go install -installsuffix cgo "${goflags[@]:+${goflags[@]}}" -ldflags "${version_ldflags}" "${binary}"' exited with status 1
Call stack:
1: /home/vagrant/go/src/github.com/GoogleCloudPlatform/kubernetes/hack/lib/golang.sh:328 kube::golang::build_binaries(...)
2: ./hack/build-go.sh:26 main(...)
Exiting with status 1
!!! Error in /home/vagrant/go/src/github.com/GoogleCloudPlatform/kubernetes/hack/lib/golang.sh:252
'( set -x; kube::golang::setup_env; local version_ldflags; version_ldflags=$(kube::version::ldflags); local host_platform; host_platform=$(kube::golang::host_platform); local goflags; eva
l "goflags=(${KUBE_GOFLAGS:-})"; local use_go_build; local -a targets=(); local arg; for arg in "$@";
do
if [[ "${arg}" == "--use_go_build" ]]; then
use_go_build=true;
else
if [[ "${arg}" == -* ]]; then
goflags+=("${arg}");
else
targets+=("${arg}");
fi;
fi;
done; if [[ ${#targets[@]} -eq 0 ]]; then
targets=("${KUBE_ALL_TARGETS[@]}");
fi; local -a platforms=("${KUBE_BUILD_PLATFORMS[@]:+${KUBE_BUILD_PLATFORMS[@]}}"); if [[ ${#platforms[@]} -eq 0 ]]; then
platforms=("${host_platform}");
fi; local binaries; binaries=($(kube::golang::binaries_from_targets "${targets[@]}")); local platform; for platform in "${platforms[@]}";
do
kube::golang::set_platform_envs "${platform}"; kube::log::status "Building go targets for ${platform}:" "${targets[@]}"; if [[ -n ${use_go_build:-} ]]; then
local output_path="${KUBE_GOPATH}/bin"; if [[ $platform != $host_platform ]]; then
output_path="${output_path}/${platform//\//_}";
fi; for binary in "${binaries[@]}";
do
local bin=$(basename "${binary}"); if [[ ${GOOS} == "windows" ]]; then
bin="${bin}.exe";
fi; if kube::golang::is_statically_linked_library "${binary}"; then
CGO_ENABLED=0 go build -installsuffix cgo -o "${output_path}/${bin}" "${goflags[@]:+${goflags[@]}}" -ldflags "${version_ldflags}" "${binary}";
else
go build -o "${output_path}/${bin}" "${goflags[@]:+${goflags[@]}}" -ldflags "${version_ldflags}" "${binary}";
fi;
done;
else
for binary in "${binaries[@]}";
do
if kube::golang::is_statically_linked_library "${binary}"; then
CGO_ENABLED=0 go install -installsuffix cgo "${goflags[@]:+${goflags[@]}}" -ldflags "${version_ldflags}" "${binary}";
else
go install "${goflags[@]:+${goflags[@]}}" -ldflags "${version_ldflags}" "${binary}";
fi;
done;
fi;
done )' exited with status 1
Call stack:
1: /home/vagrant/go/src/github.com/GoogleCloudPlatform/kubernetes/hack/lib/golang.sh:252 kube::golang::build_binaries(...)
2: ./hack/build-go.sh:26 main(...)
Exiting with status 1

It looks like this comes from #5574. Could someone please take a look? Thanks!