1 | #!/bin/sh |
2 | |
3 | BUILD_CMD="$1" |
4 | |
5 | _do_build() { |
6 | $BUILD_CMD && { |
7 | echo -e "\033[32;1;4mSuccess\033[0m" |
8 | } || { |
9 | echo -e "\033[31;1;4mFailure\033[0m" |
10 | } |
11 | } |
12 | |
13 | _do_build |
14 | inotifywait -m -e close_write,moved_to --include '.*go$' --format %e/%f . | \ |
15 | while IFS=/ read -r events file; do |
16 | echo "file $file modified, rebuilding" |
17 | _do_build |
18 | done |