github.com/deemoprobe/k8s-first-commit@v0.0.0-20230430165612-a541f1982be3/src/scripts/config-go.sh (about) 1 # Copyright 2014 Google Inc. All rights reserved. 2 # 3 # Licensed under the Apache License, Version 2.0 (the "License"); 4 # you may not use this file except in compliance with the License. 5 # You may obtain a copy of the License at 6 # 7 # http://www.apache.org/licenses/LICENSE-2.0 8 # 9 # Unless required by applicable law or agreed to in writing, software 10 # distributed under the License is distributed on an "AS IS" BASIS, 11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 # See the License for the specific language governing permissions and 13 # limitations under the License. 14 15 # This script sets up a go workspace locally and builds all go components. 16 # You can 'source' this file if you want to set up GOPATH in your local shell. 17 18 pushd $(dirname "${BASH_SOURCE}")/../.. >/dev/null 19 KUBE_REPO_ROOT="${PWD}" 20 KUBE_TARGET="${KUBE_REPO_ROOT}/target" 21 popd >/dev/null 22 23 mkdir -p "${KUBE_TARGET}" 24 25 KUBE_GO_PACKAGE=github.com/GoogleCloudPlatform/kubernetes 26 export GOPATH="${KUBE_TARGET}" 27 KUBE_GO_PACKAGE_DIR="${GOPATH}/src/${KUBE_GO_PACKAGE}" 28 29 ( 30 PACKAGE_BASE=$(dirname "${KUBE_GO_PACKAGE_DIR}") 31 if [ ! -d "${PACKAGE_BASE}" ]; then 32 mkdir -p "${PACKAGE_BASE}" 33 fi 34 35 rm "${KUBE_GO_PACKAGE_DIR}" >/dev/null 2>&1 || true 36 ln -s "${KUBE_REPO_ROOT}" "${KUBE_GO_PACKAGE_DIR}" 37 38 # Link in each of the third party packages 39 THIRD_PARTY_BASE="${KUBE_REPO_ROOT}/third_party" 40 source "${THIRD_PARTY_BASE}/deps.sh" 41 for p in ${PACKAGES}; do 42 PACKAGE_DIR="${GOPATH}/src/${p}" 43 PACKAGE_BASE=$(dirname "${PACKAGE_DIR}") 44 45 if [ ! -d "${PACKAGE_BASE}" ]; then 46 mkdir -p "${PACKAGE_BASE}" 47 fi 48 49 rm "${PACKAGE_DIR}" >/dev/null 2>&1 || true 50 ln -s "${THIRD_PARTY_BASE}/${p}" "${PACKAGE_DIR}" 51 done 52 53 for p in ${PACKAGES}; do 54 go install $p 55 done 56 )