Last active
June 22, 2020 06:03
-
-
Save ElXreno/d5aee8f481c465ad7286e4215792f756 to your computer and use it in GitHub Desktop.
Golang vendored source generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
set -e | |
if [ -z "$1" ] || [ -z "$2" ]; then | |
echo "Usage: $0 GIT_URL GIT_TAG" | |
echo "Example: $0 https://github.com/go-gitea/gitea.git v1.12.1" | |
exit 1 | |
fi | |
REPO_URL="$1" | |
REPO_NAME="`basename $REPO_URL | cut -d . -f 1`" | |
NAME="$REPO_NAME-sources-$2" | |
rm -rf $NAME | |
git clone --branch $2 --depth=1 $REPO_URL $NAME | |
pushd $NAME | |
GO111MODULE=on go mod vendor | |
popd | |
rm -f $NAME.tar.gz | |
tar --exclude $NAME/.git -cf - $NAME | pigz -9 - > $NAME.tar.gz | |
rm -rf $NAME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment