Skip to content

Instantly share code, notes, and snippets.

@zabawaba99
Created July 28, 2015 19:23
Show Gist options
  • Save zabawaba99/02ad0134ef5ecce52066 to your computer and use it in GitHub Desktop.
Save zabawaba99/02ad0134ef5ecce52066 to your computer and use it in GitHub Desktop.
Auditing and Updating your Godeps
#!/bin/bash
function update-dep() {
echo "Auditing $1"
curdir=$(pwd)
cd $GOPATH/src/$1
git checkout master > /dev/null 2>&1
git pull > /dev/null 2>&1
cd $curdir
godep update $1/...
if ! godep go build; then
return 1
fi
if ! godep go test ./...; then
return 1
fi
git add Godeps/*
git commit -m "updating $1"
}
cat Godeps/Godeps.json | jq -r '.Deps[].ImportPath' | cut -d '/' -f 1-3 | sort -u | xargs -n1 update-dep
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment