Skip to content

Instantly share code, notes, and snippets.

@jee1mr
Created July 6, 2015 14:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jee1mr/55bd38e5163641f16889 to your computer and use it in GitHub Desktop.
Save jee1mr/55bd38e5163641f16889 to your computer and use it in GitHub Desktop.
Auto script for getting Go dependencies
#!/usr/bin/python
import re
import commands
build_error = commands.getoutput("go build")
print "go build errors:"
print build_error
sources = re.findall(r"cannot find package \"[a-zA-Z.\/]*\"",build_error)
print "Running go get:"
for source in sources:
link = source.strip("cannot find package")
print("Getting " + link)
commands.getoutput("go get "+link)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment