Skip to content

Instantly share code, notes, and snippets.

@manigandand
Created October 21, 2021 09:10
Show Gist options
  • Save manigandand/b07018a86660eaaa7cefd5c8ac978cb2 to your computer and use it in GitHub Desktop.
Save manigandand/b07018a86660eaaa7cefd5c8ac978cb2 to your computer and use it in GitHub Desktop.
go get private repo
#!/bin/bash
BRANCH=$1
if [ "$BRANCH" == "" ]; then
BRANCH=$(git branch | grep "*" | sed s,*\ *,,g)
fi
if [ "$BRANCH" == "" ]; then
echo -n "No branch found"
exit 22;
fi
GIT_HASH=$(git ls-remote [email protected]:gopherhut/core $BRANCH | awk -F' ' '{print $1}')
COREMAJOR=$(cat go.mod | grep -Eo 'core/v\d+' | sed s,core,,g)
echo $AUXMAJOR
echo $GIT_HASH
go get github.com/gopherhut/core$COREMAJOR@$GIT_HASH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment