third_party: no more import path rewriting because Go 1.5

We don't rewrite import paths anymore, because we use the new vendor
mechanism that comes with Go 1.5.

Also remove misc/pre-commit.githook because of the above, and because
the rest is covered by devcam hook.

Change-Id: Iafb32e19b21d1df44b9625a5f58bf898e6b51fa8
This commit is contained in:
mpl 2015-08-21 20:00:57 +02:00
parent b118fc23fb
commit 328ec25f9c
2 changed files with 0 additions and 89 deletions

View File

@ -1,61 +0,0 @@
#!/usr/bin/env sh
mode=${1:-"precommit"}
exitstatus=0
#third_party imports.
cd third_party
rewrite=`./rewrite-imports.sh -l`
cd ..
if [ -n "$rewrite" ]
then
exitstatus=1
for r in $rewrite
do
echo $r
done
echo "The above need their imports to be fixed. Use third_party/rewrite-imports.sh -w"
fi
#gofmt and trailing space errors
committed=`git diff-index --cached --name-only HEAD`
needFmt=""
for c in $committed
do
if [ ! -e "$c" ]
then
continue
fi
gofile=`echo $c | grep -E '.*\.go$'`
javafile=`echo $c | grep -E '.*\.java$'`
if [ -n "$gofile" ]
then
fmtdiff=`git show ":$c" | gofmt -d 2>&1`
if [ -n "$fmtdiff" ]
then
needFmt="$needFmt $gofile"
exitstatus=1
fi
fi
if [ -n "$gofile" -o -n "$javafile" ]
then
trailspace=`git diff-index --cached --check HEAD $c | grep 'trailing whitespace'`
if [ -n "$trailspace" ]
then
echo $trailspace
exitstatus=1
fi
fi
done
if [ "$exitstatus" -ne 0 ]
then
if [ -n "$needFmt" ]
then
echo "gofmt -w $needFmt"
fi
if [ "$mode" != "test" ]; then
echo "You can override this check with 'git commit --no-verify'"
fi
fi
exit $exitstatus

View File

@ -1,28 +0,0 @@
#!/bin/sh
#TODO(mpl): patch github.com/cznic/zappy on the fly to make it pure Go.
if [ "$1" = "-l" ]
then
find . -type f -name '*.go' -exec grep -E -l '"code.google.com/' {} \;
find . -type f -name '*.go' -exec grep -E -l '"launchpad.net/' {} \;
find . -type f -name '*.go' -exec grep -E -l '"github.com/' {} \;
find . -type f -name '*.go' -exec grep -E -l '"labix.org/' {} \;
find . -type f -name '*.go' -exec grep -E -l '"bazil.org/' {} \;
find . -type f -name '*.go' -exec grep -E -l '"golang.org/' {} \;
find . -type f -name '*.go' -exec grep -E -l '"google.golang.org/' {} \;
elif [ "$1" = "-w" ]
then
find . -type f -name '*.go' -exec perl -pi -e 's!"code.google.com/!"camlistore.org/third_party/code.google.com/!' {} \;
find . -type f -name '*.go' -exec perl -pi -e 's!"launchpad.net/!"camlistore.org/third_party/launchpad.net/!' {} \;
find . -type f -name '*.go' -exec perl -pi -e 's!"github.com/!"camlistore.org/third_party/github.com/!' {} \;
find . -type f -name '*.go' -exec perl -pi -e 's!"labix.org/!"camlistore.org/third_party/labix.org/!' {} \;
find . -type f -name '*.go' -exec perl -pi -e 's!"bazil.org/!"camlistore.org/third_party/bazil.org/!' {} \;
find . -type f -name '*.go' -exec perl -pi -e 's!"golang.org/!"camlistore.org/third_party/golang.org/!' {} \;
find . -type f -name '*.go' -exec perl -pi -e 's!"google.golang.org/!"camlistore.org/third_party/google.golang.org/!' {} \;
else
cat << heredoc
usage: rewrite-imports.sh -l|-w"
-l: list files where a rewrite is needed"
-w: actually performs the rewrite"
heredoc
fi