Factor print_file into a script

pull/321/head
Eugene Kim 6 years ago
parent fd45de0fd1
commit 02a42cdcbd
  1. 4
      scripts/print_file.sh
  2. 16
      scripts/travis_checker.sh

@ -0,0 +1,4 @@
#!/bin/sh
echo "--- BEGIN ${2} ---"
cat "${1}"
echo "--- END ${2} ---"

@ -1,17 +1,5 @@
#!/bin/bash #!/bin/bash
# Print a file surrounded by BEGIN/END preamble, e.g.:
#
# --- BEGIN a.out output ---
# Hello world
# --- END a.out output ---
#
print_file() {
echo "--- BEGIN ${2} ---"
cat "${1}"
echo "--- END ${2} ---"
}
unset -v ok tmpdir go_files go_dirs goimports_output golint_output progdir unset -v ok tmpdir go_files go_dirs goimports_output golint_output progdir
ok=true ok=true
@ -60,7 +48,7 @@ then
echo "golint passed." echo "golint passed."
else else
echo "golint FAILED!" echo "golint FAILED!"
print_file "${golint_output}" "golint" "${progdir}/print_file.sh" "${golint_output}" "golint"
ok=false ok=false
fi fi
@ -70,7 +58,7 @@ xargs goimports -d -e < "${go_files}" > "${goimports_output}" 2>&1
if [ -s "${goimports_output}" ] if [ -s "${goimports_output}" ]
then then
echo "goimports FAILED!" echo "goimports FAILED!"
print_file "${goimports_output}" "goimports" "${progdir}/print_file.sh" "${goimports_output}" "goimports"
ok=false ok=false
else else
echo "goimports passed." echo "goimports passed."

Loading…
Cancel
Save