Replace gometalinter with golangci-lint
Replacing gometalinter, because it has been deprecated, and the repository was archived. Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
This commit is contained in:
parent
e92e0d358a
commit
85b89c9e50
8 changed files with 65 additions and 56 deletions
|
@ -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
|
||||
|
@ -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/
|
||||
|
|
11
hack/dockerfile/install/golangci_lint.installer
Executable file
11
hack/dockerfile/install/golangci_lint.installer
Executable file
|
@ -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"
|
||||
}
|
|
@ -1,12 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
GOMETALINTER_COMMIT=v2.0.6
|
||||
|
||||
install_gometalinter() {
|
||||
echo "Installing gometalinter version $GOMETALINTER_COMMIT"
|
||||
go get -d github.com/alecthomas/gometalinter
|
||||
cd "$GOPATH/src/github.com/alecthomas/gometalinter"
|
||||
git checkout -q "$GOMETALINTER_COMMIT"
|
||||
go build -buildmode=pie -o "${PREFIX}/gometalinter" "github.com/alecthomas/gometalinter"
|
||||
GOBIN=${PREFIX} "${PREFIX}/gometalinter" --install
|
||||
}
|
|
@ -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
|
||||
|
|
19
hack/validate/golangci-lint
Executable file
19
hack/validate/golangci-lint
Executable file
|
@ -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
hack/validate/golangci-lint.yml
Normal file
31
hack/validate/golangci-lint.yml
Normal file
|
@ -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
|
|
@ -1,14 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
set -e -o pipefail
|
||||
|
||||
SCRIPTDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
|
||||
|
||||
# CI platforms differ, so per-platform GOMETALINTER_OPTS can be set
|
||||
# in the Jenkinsfile, otherwise let's just set a
|
||||
# (somewhat pessimistic) default of 10 minutes.
|
||||
: "${GOMETALINTER_OPTS=--deadline=10m}"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
gometalinter \
|
||||
${GOMETALINTER_OPTS} \
|
||||
--config "${SCRIPTDIR}/gometalinter.json" ./...
|
|
@ -1,26 +0,0 @@
|
|||
{
|
||||
"Vendor": true,
|
||||
"EnableGC": true,
|
||||
"Sort": ["linter", "severity", "path"],
|
||||
"Exclude": [
|
||||
".*\\.pb\\.go",
|
||||
"dockerversion/version_autogen.go",
|
||||
"api/types/container/container_.*",
|
||||
"api/types/volume/volume_.*",
|
||||
"integration-cli/"
|
||||
],
|
||||
"Skip": ["integration-cli/"],
|
||||
|
||||
"Enable": [
|
||||
"deadcode",
|
||||
"gofmt",
|
||||
"goimports",
|
||||
"golint",
|
||||
"gosimple",
|
||||
"ineffassign",
|
||||
"unconvert",
|
||||
"vet"
|
||||
],
|
||||
|
||||
"LineLength": 200
|
||||
}
|
Loading…
Reference in a new issue