github.com/nsqio/nsq@v1.3.0/test.sh (about)

     1  #!/bin/sh
     2  set -e
     3  
     4  GOMAXPROCS=1 go test -timeout 90s ./...
     5  
     6  if [ "$GOARCH" = "amd64" ] || [ "$GOARCH" = "arm64" ]; then
     7      # go test: -race is only supported on linux/amd64, linux/ppc64le,
     8      # linux/arm64, freebsd/amd64, netbsd/amd64, darwin/amd64 and windows/amd64
     9      GOMAXPROCS=4 go test -timeout 90s -race ./...
    10  fi
    11  
    12  # no tests, but a build is something
    13  for dir in apps/*/ bench/*/; do
    14      dir=${dir%/}
    15      if grep -q '^package main$' $dir/*.go 2>/dev/null; then
    16          echo "building $dir"
    17          go build -o $dir/$(basename $dir) ./$dir
    18      else
    19          echo "(skipped $dir)"
    20      fi
    21  done
    22  
    23  # disable "composite literal uses unkeyed fields"
    24  go vet -composites=false ./...
    25  
    26  FMTDIFF="$(find apps internal nsqd nsqlookupd -name '*.go' -exec gofmt -d '{}' ';')"
    27  if [ -n "$FMTDIFF" ]; then
    28      printf '%s\n' "$FMTDIFF"
    29      exit 1
    30  fi