diff --git a/Makefile b/Makefile index 54271880a..0d3d92aa2 100644 --- a/Makefile +++ b/Makefile @@ -45,7 +45,7 @@ version: ## print current cri plugin release version lint: @echo "$(WHALE) $@" - @./hack/verify-lint.sh + golangci-lint run --skip-files .*_test.go gofmt: @echo "$(WHALE) $@" @@ -159,19 +159,18 @@ else git-validation -v -run DCO,short-subject -range $(EPOCH_TEST_COMMIT)..HEAD endif -.PHONY: install.tools .install.gitvalidation .install.gometalinter .install.vndr +.PHONY: install.tools .install.gitvalidation .install.golangci-lint .install.vndr -install.tools: .install.gitvalidation .install.gometalinter .install.vndr ## install tools used by verify +install.tools: .install.gitvalidation .install.golangci-lint .install.vndr ## install tools used by verify @echo "$(WHALE) $@" .install.gitvalidation: @echo "$(WHALE) $@" $(GO) get -u github.com/vbatts/git-validation -.install.gometalinter: +.install.golangci-lint: @echo "$(WHALE) $@" - $(GO) get -u github.com/alecthomas/gometalinter - gometalinter --install + $(GO) get -u github.com/golangci/golangci-lint/cmd/golangci-lint .install.vndr: @echo "$(WHALE) $@" diff --git a/hack/verify-lint.sh b/hack/verify-lint.sh deleted file mode 100755 index 1765f3c4a..000000000 --- a/hack/verify-lint.sh +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash -# Copyright 2017 The Kubernetes Authors. -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -set -o errexit -set -o nounset -set -o pipefail - -for d in $(find . -type d -a \( -iwholename './pkg*' -o -iwholename './cmd*' \) -not -iwholename './pkg/api*'); do - echo for directory ${d} ... - gometalinter \ - --exclude='error return value not checked.*(Close|Log|Print|Fprint).*\(errcheck\)$' \ - --exclude='.*_test\.go:.*error return value not checked.*\(errcheck\)$' \ - --exclude='duplicate of.*_test.go.*\(dupl\)$' \ - --exclude='.*/mock_.*\.go:.*\(golint\)$' \ - --exclude='declaration of "err" shadows declaration.*\(vetshadow\)$' \ - --exclude='struct of size .* could be .* \(maligned\)$' \ - --disable=aligncheck \ - --disable=gotype \ - --disable=gas \ - --disable=gosec \ - --cyclo-over=60 \ - --dupl-threshold=100 \ - --tests \ - --deadline=600s "${d}" -done diff --git a/integration/test_utils.go b/integration/test_utils.go index 1e730d9b5..869b46355 100644 --- a/integration/test_utils.go +++ b/integration/test_utils.go @@ -21,6 +21,7 @@ import ( "encoding/json" "flag" "fmt" + "net" "os/exec" "strconv" "strings" @@ -350,7 +351,13 @@ func RawRuntimeClient() (runtime.RuntimeServiceClient, error) { } ctx, cancel := context.WithTimeout(context.Background(), timeout) defer cancel() - conn, err := grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithDialer(dialer)) + conn, err := grpc.DialContext(ctx, addr, grpc.WithInsecure(), grpc.WithContextDialer( + func(ctx context.Context, addr string) (net.Conn, error) { + if deadline, ok := ctx.Deadline(); ok { + return dialer(addr, time.Until(deadline)) + } + return dialer(addr, 0) + })) if err != nil { return nil, errors.Wrap(err, "failed to connect cri endpoint") }