Skip to content
This repository was archived by the owner on May 20, 2024. It is now read-only.

Commit ed88f16

Browse files
config golangci-lint
1 parent 759d09b commit ed88f16

File tree

4 files changed

+29
-5
lines changed

4 files changed

+29
-5
lines changed

.pre-commit-config.yaml

+5-2
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,13 @@ repos:
1616
- id: cspell
1717
args: [--config, "./cspell.json"]
1818

19-
- repo: https://github.com/golangci/golangci-lint
20-
rev: v1.55.2
19+
- repo: local
2120
hooks:
2221
- id: golangci-lint
22+
name: golangci-lint
23+
entry: sh -c 'cd api/ && docker build --target lint -t nfc-entry-management-api-lint:latest -f ./Dockerfile . && docker run --rm nfc-entry-management-api-lint:latest'
24+
language: system
25+
types: [go]
2326

2427
- repo: local
2528
hooks:

api/.golangci.yml

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
linters:
2+
enable-all: false
3+
disable-all: false
4+
fast: false

api/Dockerfile

+17-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM golang:1.21.6-alpine
1+
FROM golang:1.21.6-alpine AS base
22

33
WORKDIR /app
44

@@ -9,3 +9,19 @@ RUN apk add --no-cache git && \
99
go install -v golang.org/x/tools/gopls@latest
1010

1111
RUN go mod tidy
12+
13+
ENV PATH="/app/bin:${PATH}"
14+
15+
# development stage
16+
FROM base AS development
17+
18+
RUN wget -O- -nv https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v1.55.2
19+
20+
# ENV PATH="/root/go/bin:${PATH}"
21+
22+
# lint stage
23+
FROM development AS lint
24+
25+
COPY .golangci.yml .
26+
27+
CMD [ "golangci-lint","run" ]

docker-compose.yml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
services:
22
api :
3-
container_name: nfc-entry-management-api
4-
image: nfc-entry-management-api:latest
3+
container_name: nfc-entry-management-api-development
4+
image: nfc-entry-management-api-development:latest
55
build:
66
context: ./api
77
dockerfile: Dockerfile
8+
target: development
89
volumes:
910
- ./api/src:/app
1011
ports :

0 commit comments

Comments
 (0)