Factor golint validation into a script

This script (scripts/golint.sh) handily exempts vendored and generated
files.

Sample usage:

* “scripts/goimports.sh -d -e” → show full diff
* “scripts/goimports.sh -w” → fix files in-place
pull/321/head
Eugene Kim 6 years ago
parent 97809dd0dd
commit bb3d29f476
  1. 8
      scripts/golint.sh
  2. 8
      scripts/travis_checker.sh

@ -0,0 +1,8 @@
#!/bin/sh
unset -v progdir
case "${0}" in
*/*) progdir="${0%/*}";;
*) progdir=.;;
esac
"${progdir}/list_harmony_go_files.sh" | "${progdir}/dirnames.sh" | \
sort -u -t/ | xargs golint "$@"

@ -1,6 +1,6 @@
#!/bin/bash
unset -v ok tmpdir go_dirs goimports_output golint_output progdir
unset -v ok tmpdir goimports_output golint_output progdir
ok=true
case "${0}" in
@ -14,10 +14,6 @@ tmpdir=
trap 'case "${tmpdir}" in ?*) rm -rf "${tmpdir}";; esac' EXIT
tmpdir=$(mktemp -d)
go_dirs="${tmpdir}/go_dirs.txt"
"${progdir}/list_harmony_go_files.sh" | "${progdir}/dirnames.sh" | sort -u -t/ > "${go_dirs}"
echo "Running go test..."
if go test -v -count=1 ./...
then
@ -29,7 +25,7 @@ fi
echo "Running golint..."
golint_output="${tmpdir}/golint_output.txt"
if xargs golint -set_exit_status < "${go_dirs}" > "${golint_output}" 2>&1
if "${progdir}/golint.sh" -set_exit_status > "${golint_output}" 2>&1
then
echo "golint passed."
else

Loading…
Cancel
Save