Created
May 25, 2015 00:21
-
-
Save GeorgeErickson/c579dc6712517c3007c7 to your computer and use it in GitHub Desktop.
Shit script for dep tracking
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
#!/usr/bin/env bash | |
set -eE -o pipefail | |
imports=$(go list -f '{{join .Imports "\n"}} {{join .TestImports "\n"}}' ./... | xargs go list -f '{{if not .Standard}}{{.ImportPath}}{{end}}' | grep -v `go list -f '{{.ImportPath}}'` | sort) | |
godeps=$(awk '{print $1}' Godeps | sort) | |
gopath_all=$(cd $GOPATH && find . -type d -name '*.git' | cut -c 7- | sed 's/\/.git$//' | sort) | |
cmp_github() { | |
lp="${GOPATH%%:*}/src/${1%%/...}" | |
current=$(git -C $lp log -n 1 --pretty=oneline | cut -d " " -f 1) | |
echo $current | |
latest=$(git -C $lp ls-remote origin HEAD | cut -f 1) | |
if [ "$current" == "$latest" ] | |
then | |
return | |
fi | |
ghurl=$(git -C $lp config remote.origin.url) | |
open "${ghurl}/compare/${current}...${latest}" | |
} | |
for dep in $godeps; | |
do | |
cmp_github $dep | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment