-
Notifications
You must be signed in to change notification settings - Fork 0
/
.envrc
46 lines (43 loc) · 1.67 KB
/
.envrc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File: /.envrc
# Project: integration-operator
# File Created: 17-10-2023 10:51:29
# Author: Clay Risser
# -----
# BitSpur (c) Copyright 2021 - 2023
#
# Licensed under the GNU Affero General Public License (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.gnu.org/licenses/agpl-3.0.en.html
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# You can be released from the requirements of the license by purchasing
# a commercial license. Buying such a license is mandatory as soon as you
# develop commercial activities involving this software without disclosing
# the source code of your own applications.
export GO_VERSION="$(cat go.mod | grep -E '^go ' | sed 's|^go ||g')"
use_golang() {
export GVM_PKGSET=$(pwd | sed 's|.*\/||g')
[[ -s "$GVM_ROOT/scripts/gvm" ]] && source "$GVM_ROOT/scripts/gvm"
if ! (gvm list | grep -q "$GO_VERSION"); then
INSTALL_LOG=$(mktemp)
gvm install go$GO_VERSION -B 2>&1 | tee $INSTALL_LOG
cat $INSTALL_LOG
if (cat $INSTALL_LOG | grep -q "ERROR: Binary Go unavailable for this platform"); then
gvm install go$GO_VERSION
fi
rm -rf $INSTALL_LOG 2>/dev/null || true
fi
gvm use go$GO_VERSION
if ! (gvm pkgset list | grep -q "$GVM_PKGSET"); then
gvm pkgset create $GVM_PKGSET
fi
gvm pkgset use $GVM_PKGSET
}
use_golang