mirror of
https://github.com/kubernetes-sigs/prometheus-adapter.git
synced 2026-04-07 22:25:03 +00:00
*: revendor dependencies after moving to go1.12
This commit is contained in:
parent
a47edfe5a9
commit
552284f174
371 changed files with 57445 additions and 108763 deletions
93
vendor/google.golang.org/grpc/vet.sh
generated
vendored
Executable file → Normal file
93
vendor/google.golang.org/grpc/vet.sh
generated
vendored
Executable file → Normal file
|
|
@ -13,18 +13,15 @@ die() {
|
|||
exit 1
|
||||
}
|
||||
|
||||
# Check to make sure it's safe to modify the user's git repo.
|
||||
if git status --porcelain | read; then
|
||||
die "Uncommitted or untracked files found; commit changes first"
|
||||
fi
|
||||
fail_on_output() {
|
||||
tee /dev/stderr | (! read)
|
||||
}
|
||||
|
||||
if [[ -d "${GOPATH}/src" ]]; then
|
||||
die "\${GOPATH}/src (${GOPATH}/src) exists; this script will delete it."
|
||||
fi
|
||||
# Check to make sure it's safe to modify the user's git repo.
|
||||
git status --porcelain | fail_on_output
|
||||
|
||||
# Undo any edits made by this script.
|
||||
cleanup() {
|
||||
rm -rf "${GOPATH}/src"
|
||||
git reset --hard HEAD
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
|
@ -35,7 +32,7 @@ if [[ "$1" = "-install" ]]; then
|
|||
# Check for module support
|
||||
if go help mod >& /dev/null; then
|
||||
go install \
|
||||
github.com/golang/lint/golint \
|
||||
golang.org/x/lint/golint \
|
||||
golang.org/x/tools/cmd/goimports \
|
||||
honnef.co/go/tools/cmd/staticcheck \
|
||||
github.com/client9/misspell/cmd/misspell \
|
||||
|
|
@ -45,7 +42,7 @@ if [[ "$1" = "-install" ]]; then
|
|||
# Note: this gets the latest version of all tools (vs. the pinned versions
|
||||
# with Go modules).
|
||||
go get -u \
|
||||
github.com/golang/lint/golint \
|
||||
golang.org/x/lint/golint \
|
||||
golang.org/x/tools/cmd/goimports \
|
||||
honnef.co/go/tools/cmd/staticcheck \
|
||||
github.com/client9/misspell/cmd/misspell \
|
||||
|
|
@ -69,54 +66,58 @@ elif [[ "$#" -ne 0 ]]; then
|
|||
die "Unknown argument(s): $*"
|
||||
fi
|
||||
|
||||
git ls-files "*.go" | xargs grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)\|DO NOT EDIT" 2>&1 | tee /dev/stderr | (! read)
|
||||
git ls-files "*.go" | xargs grep -l '"math/rand"' 2>&1 | (! grep -v '^examples\|^stress\|grpcrand') | tee /dev/stderr | (! read)
|
||||
git ls-files | xargs dirname | sort | uniq | xargs go run go_vet/vet.go | tee /dev/stderr | (! read)
|
||||
gofmt -s -d -l . 2>&1 | tee /dev/stderr | (! read)
|
||||
goimports -l . 2>&1 | tee /dev/stderr | (! read)
|
||||
golint ./... 2>&1 | (grep -vE "(_mock|\.pb)\.go:" || true) | tee /dev/stderr | (! read)
|
||||
# - Ensure all source files contain a copyright message.
|
||||
git ls-files "*.go" | xargs grep -L "\(Copyright [0-9]\{4,\} gRPC authors\)\|DO NOT EDIT" 2>&1 | fail_on_output
|
||||
|
||||
# Rewrite golang.org/x/net/context -> context imports (see grpc/grpc-go#1484).
|
||||
# TODO: Remove this mangling once "context" is imported directly (grpc/grpc-go#711).
|
||||
git ls-files "*.go" | xargs sed -i 's:"golang.org/x/net/context":"context":'
|
||||
set +o pipefail # vet exits with non-zero error if issues are found
|
||||
go tool vet -all . 2>&1 | grep -vE 'clientconn.go:.*cancel (function|var)' | tee /dev/stderr | (! read)
|
||||
set -o pipefail
|
||||
git reset --hard HEAD
|
||||
# - Make sure all tests in grpc and grpc/test use leakcheck via Teardown.
|
||||
(! grep 'func Test[^(]' *_test.go)
|
||||
(! grep 'func Test[^(]' test/*.go)
|
||||
|
||||
# - Do not import math/rand for real library code. Use internal/grpcrand for
|
||||
# thread safety.
|
||||
git ls-files "*.go" | xargs grep -l '"math/rand"' 2>&1 | (! grep -v '^examples\|^stress\|grpcrand')
|
||||
|
||||
# - Ensure all ptypes proto packages are renamed when importing.
|
||||
git ls-files "*.go" | (! xargs grep "\(import \|^\s*\)\"github.com/golang/protobuf/ptypes/")
|
||||
|
||||
# - Check imports that are illegal in appengine (until Go 1.11).
|
||||
# TODO: Remove when we drop Go 1.10 support
|
||||
go list -f {{.Dir}} ./... | xargs go run test/go_vet/vet.go
|
||||
|
||||
# - gofmt, goimports, golint (with exceptions for generated code), go vet.
|
||||
gofmt -s -d -l . 2>&1 | fail_on_output
|
||||
goimports -l . 2>&1 | fail_on_output
|
||||
golint ./... 2>&1 | (! grep -vE "(_mock|\.pb)\.go:")
|
||||
go tool vet -all .
|
||||
|
||||
# - Check that generated proto files are up to date.
|
||||
if [[ -z "${VET_SKIP_PROTO}" ]]; then
|
||||
PATH="/home/travis/bin:${PATH}" make proto && \
|
||||
git status --porcelain 2>&1 | (! read) || \
|
||||
git status --porcelain 2>&1 | fail_on_output || \
|
||||
(git status; git --no-pager diff; exit 1)
|
||||
fi
|
||||
|
||||
# - Check that our module is tidy.
|
||||
if go help mod >& /dev/null; then
|
||||
go mod tidy && \
|
||||
git status --porcelain 2>&1 | (! read) || \
|
||||
git status --porcelain 2>&1 | fail_on_output || \
|
||||
(git status; git --no-pager diff; exit 1)
|
||||
fi
|
||||
|
||||
### HACK HACK HACK: Remove once staticcheck works with modules.
|
||||
# Make a symlink in ${GOPATH}/src to its ${GOPATH}/pkg/mod equivalent for every package we use.
|
||||
for x in $(find "${GOPATH}/pkg/mod" -name '*@*' | grep -v \/mod\/cache\/); do
|
||||
pkg="$(echo ${x#"${GOPATH}/pkg/mod/"} | cut -f1 -d@)";
|
||||
# If multiple versions exist, just use the existing one.
|
||||
if [[ -L "${GOPATH}/src/${pkg}" ]]; then continue; fi
|
||||
mkdir -p "$(dirname "${GOPATH}/src/${pkg}")";
|
||||
ln -s $x "${GOPATH}/src/${pkg}";
|
||||
done
|
||||
### END HACK HACK HACK
|
||||
|
||||
# - Collection of static analysis checks
|
||||
# TODO(menghanl): fix errors in transport_test.
|
||||
staticcheck -ignore '
|
||||
internal/transport/transport_test.go:SA2002
|
||||
benchmark/benchmain/main.go:SA1019
|
||||
stats/stats_test.go:SA1019
|
||||
test/end2end_test.go:SA1019
|
||||
balancer_test.go:SA1019
|
||||
balancer.go:SA1019
|
||||
clientconn_test.go:SA1019
|
||||
internal/transport/handler_server_test.go:SA1019
|
||||
internal/transport/handler_server.go:SA1019
|
||||
staticcheck -go 1.9 -checks 'inherit,-ST1015' -ignore '
|
||||
google.golang.org/grpc/balancer.go:SA1019
|
||||
google.golang.org/grpc/balancer_test.go:SA1019
|
||||
google.golang.org/grpc/clientconn_test.go:SA1019
|
||||
google.golang.org/grpc/balancer/roundrobin/roundrobin_test.go:SA1019
|
||||
google.golang.org/grpc/benchmark/benchmain/main.go:SA1019
|
||||
google.golang.org/grpc/benchmark/worker/benchmark_client.go:SA1019
|
||||
google.golang.org/grpc/internal/transport/handler_server.go:SA1019
|
||||
google.golang.org/grpc/internal/transport/handler_server_test.go:SA1019
|
||||
google.golang.org/grpc/stats/stats_test.go:SA1019
|
||||
google.golang.org/grpc/test/channelz_test.go:SA1019
|
||||
google.golang.org/grpc/test/end2end_test.go:SA1019
|
||||
google.golang.org/grpc/test/healthcheck_test.go:SA1019
|
||||
' ./...
|
||||
misspell -error .
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue