Skip to content

Instantly share code, notes, and snippets.

@hackebrot
Created February 14, 2017 23:57
Show Gist options
  • Save hackebrot/f4609ac55784a9ee2b0f8a8274dcbfe9 to your computer and use it in GitHub Desktop.
Save hackebrot/f4609ac55784a9ee2b0f8a8274dcbfe9 to your computer and use it in GitHub Desktop.
gvt fetch for existing project
.DEFAULT_GOAL := help
define filterstdlib
go list -f '{{ if not .Standard }}{{ .ImportPath }}{{ end }}'
endef
define getimports
go list -f '{{ join .Imports "\n" }}'
endef
.PHONY: fetch
fetch: ## Use gvt fetch to vendor dependencies
@echo "+ $@"
@$(call getimports) | xargs $(call filterstdlib) | xargs -L1 gvt fetch | tee /dev/stderr
.PHONY: help
help:
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf "\033[36m%-20s\033[0m %s\n", $$1, $$2}'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment