From 5733b6ed1d83819e274c9a8fd252c01c54d2caf6 Mon Sep 17 00:00:00 2001 From: Priya Wadhwa Date: Tue, 11 Sep 2018 10:31:20 -0700 Subject: [PATCH] Replace gometalinter with GolangCI-Lint gometalinter is broken @ HEAD, and I looked into why that was. During that process, I remembered that we took the linting scripts from skaffold, and found that in skaffold gometalinter was replaced with GolangCI-Lint: https://github.com/GoogleContainerTools/skaffold/pull/619 The change made linting in skaffold faster, so I figured instead of fixing gometalinter it made more sense to remove it and replace it with GolangCI-Lint for kaniko as well. --- hack/{gometalinter.sh => linter.sh} | 29 +++++++++++++++-------------- test.sh | 2 +- 2 files changed, 16 insertions(+), 15 deletions(-) rename hack/{gometalinter.sh => linter.sh} (61%) diff --git a/hack/gometalinter.sh b/hack/linter.sh similarity index 61% rename from hack/gometalinter.sh rename to hack/linter.sh index ab4a785118..58ef081afd 100755 --- a/hack/gometalinter.sh +++ b/hack/linter.sh @@ -14,22 +14,23 @@ # See the License for the specific language governing permissions and # limitations under the License. - -#!/bin/bash set -e -o pipefail -SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" - -install_gometalinter() { - echo "Installing gometalinter.v2" - go get -u gopkg.in/alecthomas/gometalinter.v2 - gometalinter.v2 --install -} +DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -if ! [ -x "$(command -v gometalinter.v2)" ]; then - install_gometalinter +if ! [ -x "$(command -v golangci-lint)" ]; then + echo "Installing GolangCI-Lint" + ${DIR}/install_golint.sh -b $GOPATH/bin v1.9.3 fi -gometalinter.v2 \ - ${GOMETALINTER_OPTS:--deadine 5m} \ - --config $SCRIPTDIR/gometalinter.json ./... +golangci-lint run \ + --no-config \ + -E goconst \ + -E goimports \ + -E golint \ + -E interfacer \ + -E maligned \ + -E misspell \ + -E unconvert \ + -E unparam \ + -D errcheck diff --git a/test.sh b/test.sh index c332c8f298..c86b974cde 100755 --- a/test.sh +++ b/test.sh @@ -31,7 +31,7 @@ echo "Running validation scripts..." scripts=( "hack/boilerplate.sh" "hack/gofmt.sh" - "hack/gometalinter.sh" + "hack/linter.sh" "hack/dep.sh" ) fail=0