Run golangci-lint in Docker build

master
Quentin McGaw 4 years ago
parent f5826d1950
commit d545fa9433

@ -0,0 +1,50 @@
linters-settings:
maligned:
suggest-new: true
misspell:
locale: US
linters:
disable-all: true
enable:
- bodyclose
- deadcode
- dogsled
- dupl
- errcheck
- gochecknoglobals
- gochecknoinits
- gocognit
- goconst
- gocritic
- gocyclo
- goimports
- golint
- gosec
- gosimple
- govet
- ineffassign
- interfacer
- maligned
- misspell
- nakedret
- prealloc
- rowserrcheck
- scopelint
- staticcheck
- structcheck
- typecheck
- unconvert
- unparam
- unused
- varcheck
- whitespace
run:
skip-dirs:
- .devcontainer
- .github
- postgres
service:
golangci-lint-version: 1.27.x # use the fixed version to not introduce new linters unexpectedly

@ -5,11 +5,14 @@ ARG STACKEDIT_VERSION=v5.14.5
FROM golang:${GO_VERSION}-alpine${ALPINE_VERSION} AS server
RUN apk --update add git
ENV CGO_ENABLED=0
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s ${GOLANGCI_LINT_VERSION}
WORKDIR /tmp/gobuild
COPY .golangci.yml .
COPY go.mod go.sum ./
RUN go mod download 2>&1
COPY main.go ./
#RUN go test -v -race ./...
RUN golangci-lint run --timeout=10m
RUN go build -ldflags="-s -w" -o app main.go
FROM --platform=amd64 alpine:${ALPINE_VERSION} AS stackedit

Loading…
Cancel
Save