From ea4ae91b29e3d6a5b21a49a02bfc443a5795693e Mon Sep 17 00:00:00 2001 From: Cheng Pan Date: Mon, 5 Nov 2018 11:35:57 -0800 Subject: [PATCH] Add golint verification Fixes: #83 --- hack/verify-all.sh | 1 + hack/verify-golint | 27 +++++++++++++++++++++++++++ 2 files changed, 28 insertions(+) create mode 100755 hack/verify-golint diff --git a/hack/verify-all.sh b/hack/verify-all.sh index b727caab2f..dc635a0098 100755 --- a/hack/verify-all.sh +++ b/hack/verify-all.sh @@ -20,3 +20,4 @@ PKG_ROOT=$(git rev-parse --show-toplevel) ${PKG_ROOT}/hack/verify-gofmt ${PKG_ROOT}/hack/verify-govet +${PKG_ROOT}/hack/verify-golint diff --git a/hack/verify-golint b/hack/verify-golint new file mode 100755 index 0000000000..059760e41b --- /dev/null +++ b/hack/verify-golint @@ -0,0 +1,27 @@ +#!/bin/bash + +# Copyright 2018 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 -euo pipefail + +if ! which golangci-lint > /dev/null; then + echo 'Cannot find golangci-lint. Installing golangci-lint...' + go get -v github.com/golangci/golangci-lint/cmd/golangci-lint +fi + +golangci-lint run --deadline=10m + +echo "Congratulations! All Go source files have been linted.' +