go.mercari.io/datastore@v1.8.2/test.sh (about)

     1  #!/bin/sh -eux
     2  
     3  cd `dirname $0`
     4  
     5  targets=`find . -type f \( -name '*.go' -and -not -iwholename '*vendor*' -and -not -iwholename '*testdata*' \)`
     6  packages=`go list ./... | grep -v internal/c | grep -v internal/pb`
     7  packages_wo_internal=`go list ./... | grep -v internal`
     8  
     9  # Apply tools
    10  export PATH=$(pwd)/build-cmd:$PATH
    11  which goimports golint jwg qbg
    12  goimports -w $targets
    13  for package in $packages
    14  do
    15      go vet $package
    16  done
    17  golint -set_exit_status -min_confidence 0.6 $packages_wo_internal
    18  go generate $packages
    19  
    20  export DATASTORE_EMULATOR_HOST=localhost:8081
    21  export DATASTORE_PROJECT_ID=datastore-wrapper
    22  export REDIS_HOST=
    23  export REDIS_PORT=6379
    24  export MEMCACHE_ADDR=localhost:11211
    25  
    26  # use -p 1. Cloud Datastore Emulator can't dedicated by connections. go will running package concurrently.
    27  # goapp test $packages -p 1 $@
    28  
    29  # Connect Cloud Datastore (production env)
    30  # (if you need login) → gcloud auth application-default login
    31  go test $packages -count 1 -p 1 -coverpkg=./... -covermode=atomic -coverprofile=coverage.txt $@