diff --git a/Dockerfile.dapper b/Dockerfile.dapper index 71307e94..2e69cc5e 100644 --- a/Dockerfile.dapper +++ b/Dockerfile.dapper @@ -1,20 +1,13 @@ -FROM golang:1.13.4-alpine3.10 +FROM registry.suse.com/bci/golang:1.17 ARG DAPPER_HOST_ARCH ENV ARCH $DAPPER_HOST_ARCH - -RUN apk -U add bash git gcc musl-dev docker vim less file curl wget ca-certificates -RUN go get -d golang.org/x/lint/golint && \ - git -C /go/src/golang.org/x/lint/golint checkout -b current 06c8688daad7faa9da5a0c2f163a3d14aac986ca && \ - go install golang.org/x/lint/golint && \ - rm -rf /go/src /go/pkg -RUN mkdir -p /go/src/golang.org/x && \ - cd /go/src/golang.org/x && git clone https://github.com/golang/tools && \ - git -C /go/src/golang.org/x/tools checkout -b current aa82965741a9fecd12b026fbb3d3c6ed3231b8f8 && \ - go install golang.org/x/tools/cmd/goimports +ARG CACHEBUST=1 +RUN zypper -n up && \ + zypper -n in git docker vim curl wget RUN rm -rf /go/src /go/pkg RUN if [ "${ARCH}" == "amd64" ]; then \ - curl -sL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s v1.15.0; \ + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.46.2; \ fi ENV GO111MODULE off diff --git a/scripts/validate b/scripts/validate index ff9e078e..89e40a47 100755 --- a/scripts/validate +++ b/scripts/validate @@ -5,16 +5,10 @@ cd $(dirname $0)/.. echo Running validation -PACKAGES="$(find -name '*.go' | xargs -I{} dirname {} | cut -f2 -d/ | sort -u | grep -Ev '(^\.$|.git|.trash-cache|vendor|bin)' | sed -e 's!^!./!' -e 's!$!/...!')" +if ! command -v golangci-lint; then + echo Skipping validation: no golangci-lint available + exit +fi -echo Running: go vet -go vet ${PACKAGES} -echo Running: golint -for i in ${PACKAGES}; do - if [ -n "$(golint $i | grep -v 'should have comment.*or be unexported' | tee /dev/stderr)" ]; then - failed=true - fi -done -test -z "$failed" -echo Running: go fmt -test -z "$(go fmt ${PACKAGES} | tee /dev/stderr)" +echo Running: golangci-lint +golangci-lint run