Skip to content

Commit

Permalink
Bump dependancies
Browse files Browse the repository at this point in the history
Signed-off-by: Stavros Foteinopoulos <[email protected]>
  • Loading branch information
stafot committed Apr 25, 2024
1 parent ceed7ff commit b1a1ee9
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions scripts/go_install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env bash

# Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
# See LICENSE.txt for license information.

set -o errexit
set -o nounset
set -o pipefail

if [ -z "${1}" ]; then
echo "must provide module as first parameter"
exit 1
fi

if [ -z "${2}" ]; then
echo "must provide binary name as second parameter"
exit 1
fi

if [ -z "${3}" ]; then
echo "must provide version as third parameter"
exit 1
fi

if [ -z "${GOBIN}" ]; then
echo "GOBIN is not set. Must set GOBIN to install the bin in a specified directory."
exit 1
fi

tmp_dir=$(mktemp -d -t goinstall_XXXXXXXXXX)
function clean {
rm -rf "${tmp_dir}"
}
trap clean EXIT

rm "${GOBIN}/${2}"* || true

cd "${tmp_dir}"

# create a new module in the tmp directory
go mod init fake/mod

# install the golang module specified as the first argument
go install -tags tools "${1}@${3}"
mv "${GOBIN}/${2}" "${GOBIN}/${2}-${3}"
ln -sf "${GOBIN}/${2}-${3}" "${GOBIN}/${2}"

0 comments on commit b1a1ee9

Please sign in to comment.