Skip to content

Commit

Permalink
hack: Run Go tools over ./...
Browse files Browse the repository at this point in the history
Catching up with 4e92db8 (Merge pull request #120 from
staebler/asset_graph_engine, 2018-08-24).

* Drop the go-lint comment from go-fmt.sh.  I'd accidentally
  copy/pasted this over in 87b3e17 (hack/go-fmt: Make it easy to
  auto-format Go, 2018-08-24, #173).
* Suggest users run go-lint over pkg/... as well.

* Simplify the 'go vet' invocation.  The code I'm removing is from
  eb71c8d (Added go-vet shell script, 2018-08-06, #110).  The Travis
  config it replaced was removed in 1765e93 (.travis.yml: Prune
  moved-to-Prow tf-lint, etc., 2018-08-14, #123), but was just
  running:

    go vet ./installer/...

  inside the container.  So I don't think we need the directory
  changing or moving here.  And we should certainly be able to cover
  the test from a single container, instead of launch a new container
  for each requested directory (at least as long as the requested
  directories are under $PWD, and the old script required that
  anyway).
  • Loading branch information
wking committed Aug 27, 2018
1 parent f323e0f commit dec4f3a
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 17 deletions.
2 changes: 0 additions & 2 deletions hack/go-fmt.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
#!/bin/sh
# Example: ./hack/go-lint.sh installer/... tests/smoke

if [ "$IS_CONTAINER" != "" ]; then
for TARGET in "${@}"; do
find "${TARGET}" -name '*.go' ! -path '*/vendor/*' ! -path '*/.build/*' -exec gofmt -s -w {} \+
Expand Down
2 changes: 1 addition & 1 deletion hack/go-lint.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh
# Example: ./hack/go-lint.sh installer/... tests/smoke
# Example: ./hack/go-lint.sh installer/... pkg/... tests/smoke

if [ "$IS_CONTAINER" != "" ]; then
golint -set_exit_status "${@}"
Expand Down
16 changes: 2 additions & 14 deletions hack/go-vet.sh
Original file line number Diff line number Diff line change
@@ -1,18 +1,6 @@
#!/bin/sh
if [ "$IS_CONTAINER" != "" ]; then
cd ..
SOURCE_DIR="$(pwd)"
cd .. || exit
ROOT_DIR="$(pwd)"
TARGET_DIR="${ROOT_DIR}/openshift"
if [ "$SOURCE_DIR" != "$TARGET_DIR" ]; then
mv "$SOURCE_DIR" "$TARGET_DIR"
fi;
cd "${TARGET_DIR}/installer/" || exit
go vet "$1"
go vet "${@}"
else
for dir in "$@"
do
docker run --rm --env IS_CONTAINER='TRUE' -v "$PWD":/go/src/github.com/openshift/installer -w /go/src/github.com/openshift/installer quay.io/coreos/golang-testing ./hack/go-vet.sh "$dir"
done;
docker run --rm --env IS_CONTAINER='TRUE' -v "$PWD":/go/src/github.com/openshift/installer -w /go/src/github.com/openshift/installer quay.io/coreos/golang-testing ./hack/go-vet.sh "${@}"
fi;

0 comments on commit dec4f3a

Please sign in to comment.