Skip to content

Commit 4889d78

Browse files
author
Michal Witkowski
committed
Add fixup scripts
1 parent ef60a37 commit 4889d78

File tree

2 files changed

+52
-0
lines changed

2 files changed

+52
-0
lines changed

checkup.sh

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#!/bin/bash
2+
# Script that checks up code (govet).
3+
4+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
5+
6+
function print_real_go_files {
7+
grep --files-without-match 'DO NOT EDIT!' $(find . -iname '*.go')
8+
}
9+
10+
function govet_all {
11+
ret=0
12+
for i in $(print_real_go_files); do
13+
output=$(go tool vet -all=true -tests=false ${i})
14+
ret=$(($ret | $?))
15+
echo -n ${output}
16+
done;
17+
return ${ret}
18+
}
19+
20+
govet_all
21+
echo "returning $?"

fixup.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/bin/bash
2+
# Script that checks the code for errors.
3+
4+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)"
5+
6+
function print_real_go_files {
7+
grep --files-without-match 'DO NOT EDIT!' $(find . -iname '*.go')
8+
}
9+
10+
function generate_markdown {
11+
echo "Generating markdown"
12+
oldpwd=$(pwd)
13+
for i in $(find . -iname 'doc.go'); do
14+
dir=${i%/*}
15+
echo "$dir"
16+
cd ${dir}
17+
${GOPATH}/bin/godocdown -heading=Title -o DOC.md
18+
ln -s DOC.md README.md 2> /dev/null # can fail
19+
cd ${oldpwd}
20+
done;
21+
}
22+
23+
function goimports_all {
24+
echo "Running goimports"
25+
goimports -l -w $(print_real_go_files)
26+
return $?
27+
}
28+
29+
generate_markdown
30+
goimports_all
31+
echo "returning $?"

0 commit comments

Comments
 (0)