Skip to content

Instantly share code, notes, and snippets.

@kuanyui
Last active June 2, 2023 03:19
Show Gist options
  • Save kuanyui/24feef905ec7a514d4f7efb81c32bb1a to your computer and use it in GitHub Desktop.
Save kuanyui/24feef905ec7a514d4f7efb81c32bb1a to your computer and use it in GitHub Desktop.
Makefile for gvm + $GOPATH + git checkout
.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