From 02a42cdcbd8e5ef40d7248d313808b5c2b54faa6 Mon Sep 17 00:00:00 2001 From: Eugene Kim Date: Thu, 24 Jan 2019 23:37:16 -0800 Subject: [PATCH] Factor print_file into a script --- scripts/print_file.sh | 4 ++++ scripts/travis_checker.sh | 16 ++-------------- 2 files changed, 6 insertions(+), 14 deletions(-) create mode 100755 scripts/print_file.sh diff --git a/scripts/print_file.sh b/scripts/print_file.sh new file mode 100755 index 000000000..6579ac0cb --- /dev/null +++ b/scripts/print_file.sh @@ -0,0 +1,4 @@ +#!/bin/sh +echo "--- BEGIN ${2} ---" +cat "${1}" +echo "--- END ${2} ---" diff --git a/scripts/travis_checker.sh b/scripts/travis_checker.sh index dbf48d8eb..28dc95baf 100755 --- a/scripts/travis_checker.sh +++ b/scripts/travis_checker.sh @@ -1,17 +1,5 @@ #!/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 ok=true @@ -60,7 +48,7 @@ then echo "golint passed." else echo "golint FAILED!" - print_file "${golint_output}" "golint" + "${progdir}/print_file.sh" "${golint_output}" "golint" ok=false fi @@ -70,7 +58,7 @@ xargs goimports -d -e < "${go_files}" > "${goimports_output}" 2>&1 if [ -s "${goimports_output}" ] then echo "goimports FAILED!" - print_file "${goimports_output}" "goimports" + "${progdir}/print_file.sh" "${goimports_output}" "goimports" ok=false else echo "goimports passed."