...

Text file src/github.com/GoogleCloudPlatform/k8s-config-connector/scripts/environment-setup/golang-setup.sh

Documentation: github.com/GoogleCloudPlatform/k8s-config-connector/scripts/environment-setup

     1#!/bin/bash
     2# Copyright 2022 Google LLC
     3#
     4# Licensed under the Apache License, Version 2.0 (the "License");
     5# you may not use this file except in compliance with the License.
     6# You may obtain a copy of the License at
     7#
     8#      http://www.apache.org/licenses/LICENSE-2.0
     9#
    10# Unless required by applicable law or agreed to in writing, software
    11# distributed under the License is distributed on an "AS IS" BASIS,
    12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    13# See the License for the specific language governing permissions and
    14# limitations under the License.
    15
    16# Script to set up golang on cloudtop
    17set -o errexit
    18
    19# This will pull the current go version used in the repository
    20GO_VERSION=`cat ${HOME}/go/src/github.com/GoogleCloudPlatform/k8s-config-connector/go.mod | grep -P -o "(?<=^go ).*"`
    21sudo apt-get install wget
    22wget https://go.dev/dl/go${GO_VERSION}.linux-amd64.tar.gz
    23sudo tar -xvzf go${GO_VERSION}.linux-amd64.tar.gz -C /usr/local
    24rm go${GO_VERSION}.linux-amd64.tar.gz
    25
    26echo PATH=/usr/local/go/bin:$PATH >> ~/.profile
    27source ~/.profile
    28go version
    29
    30sudo apt install jq
    31
    32echo "export GOPATH=${HOME}/go" >> ~/.profile
    33source ~/.profile
    34
    35GREEN='\033[0;32m'
    36NC='\033[0m'
    37echo -e "${GREEN}GOLANG SETUP SUCCESSFUL${NC}"

View as plain text