Skip to content

Commit

Permalink
Replace gometalinter with golangci-lint
Browse files Browse the repository at this point in the history
Replacing gometalinter, because it has been deprecated,
and the repository was archived.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Sep 18, 2019
1 parent e92e0d3 commit 85b89c9
Show file tree
Hide file tree
Showing 8 changed files with 65 additions and 56 deletions.
6 changes: 3 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,8 @@ COPY hack/dockerfile/install/install.sh ./install.sh
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME

FROM base AS gometalinter
ENV INSTALL_BINARY_NAME=gometalinter
FROM base AS golangci_lint
ENV INSTALL_BINARY_NAME=golangci_lint
COPY hack/dockerfile/install/install.sh ./install.sh
COPY hack/dockerfile/install/$INSTALL_BINARY_NAME.installer ./
RUN PREFIX=/build ./install.sh $INSTALL_BINARY_NAME
Expand Down Expand Up @@ -265,7 +265,7 @@ RUN pip3 install yamllint==1.16.0

COPY --from=swagger /build/swagger* /usr/local/bin/
COPY --from=frozen-images /build/ /docker-frozen-images
COPY --from=gometalinter /build/ /usr/local/bin/
COPY --from=golangci_lint /build/ /usr/local/bin/
COPY --from=gotestsum /build/ /usr/local/bin/
COPY --from=tomlv /build/ /usr/local/bin/
COPY --from=vndr /build/ /usr/local/bin/
Expand Down
11 changes: 11 additions & 0 deletions hack/dockerfile/install/golangci_lint.installer
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/sh

: "${GOLANGCI_LINT_COMMIT=v1.17.1}"

install_golangci_lint() {
echo "Installing golangci-lint version ${GOLANGCI_LINT_COMMIT}"
go get -d github.com/golangci/golangci-lint/cmd/golangci-lint
cd "$GOPATH/src/github.com/golangci/golangci-lint/" || exit 1
git checkout -q "${GOLANGCI_LINT_COMMIT}"
go build -buildmode=pie -o "${PREFIX}/golangci-lint" "github.com/golangci/golangci-lint/cmd/golangci-lint"
}
12 changes: 0 additions & 12 deletions hack/dockerfile/install/gometalinter.installer

This file was deleted.

2 changes: 1 addition & 1 deletion hack/validate/default
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

. ${SCRIPTDIR}/dco
. ${SCRIPTDIR}/default-seccomp
. ${SCRIPTDIR}/gometalinter
. ${SCRIPTDIR}/golangci-lint
. ${SCRIPTDIR}/pkg-imports
. ${SCRIPTDIR}/swagger
. ${SCRIPTDIR}/swagger-gen
Expand Down
19 changes: 19 additions & 0 deletions hack/validate/golangci-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e -o pipefail

SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

# CI platforms differ, so per-platform GOLANGCI_LINT_OPTS can be set
# from a platform-specific Dockerfile, otherwise let's just set
# (somewhat pessimistic) default of 10 minutes.
: ${GOLANGCI_LINT_OPTS=--deadline=20m}

[ -n "${TESTDEBUG}" ] && set -x

# TODO use --out-format=junit-xml and store artifacts
GOGC=20 golangci-lint run \
${GOLANGCI_LINT_OPTS} \
--print-resources-usage \
--build-tags="${DOCKER_BUILDTAGS}" \
--verbose \
--config ${SCRIPTDIR}/golangci-lint.yml
31 changes: 31 additions & 0 deletions hack/validate/golangci-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
linters:
enable:
- deadcode
- gofmt
- goimports
- golint
- gosimple
- govet
- ineffassign
- unconvert

disable:
- errcheck

run:
concurrency: 2
modules-download-mode: vendor

skip-dirs:
- docs
- integration-cli

skip-files:
- ".*\\.pb\\.go"
- "dockerversion/version_autogen.go"
- "api/types/container/container_.*"
- "api/types/volume/volume_.*"

linters-settings:
govet:
check-shadowing: false
14 changes: 0 additions & 14 deletions hack/validate/gometalinter

This file was deleted.

26 changes: 0 additions & 26 deletions hack/validate/gometalinter.json

This file was deleted.

0 comments on commit 85b89c9

Please sign in to comment.