...
1# Copyright 2017 Google Inc. All Rights Reserved.
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15
16#!/usr/bin/env bash
17
18set -e
19set -x
20MODE=atomic
21echo "mode: $MODE" > coverage.txt
22
23if [ "$RUN_STATICCHECK" != "false" ]; then
24 staticcheck ./...
25fi
26
27# Packages that have any tests.
28PKG=$(go list -f '{{if .TestGoFiles}} {{.ImportPath}} {{end}}' ./...)
29
30go test $PKG
31
32for d in $PKG; do
33 go test -race -coverprofile=profile.out -covermode=$MODE $d
34 if [ -f profile.out ]; then
35 cat profile.out | grep -v "^mode: " >> coverage.txt
36 rm profile.out
37 fi
38done
39
40go vet -all ./...
41if [ "$RUN_GOLANGCI_LINTER" != "false" ]; then
42 golangci-lint run -D errcheck --timeout=3m ./... # TODO: Enable errcheck back.
43fi
44
45gofmt -s -d .
View as plain text