Last active
June 2, 2023 03:19
-
-
Save kuanyui/24feef905ec7a514d4f7efb81c32bb1a to your computer and use it in GitHub Desktop.
Makefile for gvm + $GOPATH + git checkout
This file contains 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
.ONESHELL: | |
REPO_DIR="${PWD}" | |
define my_git_checkout | |
(git checkout $(1) || git checkout --track origin/$(1)) && git pull | |
endef | |
define GVM_USE | |
echo "=========================================================================================" | |
echo "[INFO] Recommended Go Version: 1.9" | |
source "${GVM_ROOT}/scripts/gvm" | |
gvm use go1.9 | |
# GOPATH should have already become ~/.gvm/pkgsets/go1.9/global | |
cd "${GOPATH}/src/github.com/foo/bar/" && $(call my_git_checkout, "master") | |
cd "${GOPATH}/src/github.com/foo/bar2/" && $(call my_git_checkout, "master") | |
cd "${REPO_DIR}" | |
echo "=========================================================================================" | |
endef |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment