Skip to content

Commit

Permalink
Add fixup scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
Michal Witkowski committed Feb 28, 2017
1 parent ef60a37 commit 4889d78
Show file tree
Hide file tree
Showing 2 changed files with 52 additions and 0 deletions.
21 changes: 21 additions & 0 deletions checkup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash
# Script that checks up code (govet).

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"

function print_real_go_files {
grep --files-without-match 'DO NOT EDIT!' $(find . -iname '*.go')
}

function govet_all {
ret=0
for i in $(print_real_go_files); do
output=$(go tool vet -all=true -tests=false ${i})
ret=$(($ret | $?))
echo -n ${output}
done;
return ${ret}
}

govet_all
echo "returning $?"
31 changes: 31 additions & 0 deletions fixup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash
# Script that checks the code for errors.

SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"

function print_real_go_files {
grep --files-without-match 'DO NOT EDIT!' $(find . -iname '*.go')
}

function generate_markdown {
echo "Generating markdown"
oldpwd=$(pwd)
for i in $(find . -iname 'doc.go'); do
dir=${i%/*}
echo "$dir"
cd ${dir}
${GOPATH}/bin/godocdown -heading=Title -o DOC.md
ln -s DOC.md README.md 2> /dev/null # can fail
cd ${oldpwd}
done;
}

function goimports_all {
echo "Running goimports"
goimports -l -w $(print_real_go_files)
return $?
}

generate_markdown
goimports_all
echo "returning $?"

0 comments on commit 4889d78

Please sign in to comment.