Skip to content

Commit 2862d3a

Browse files
committed
Install golangci-lint in docker container
1 parent 48b3107 commit 2862d3a

File tree

3 files changed

+15
-18
lines changed

3 files changed

+15
-18
lines changed

Dockerfile

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,9 @@ WORKDIR /workdir
1111

1212
RUN go build -o main
1313

14-
ENTRYPOINT ["/workdir/main"]
14+
RUN go install github.com/golangci/golangci-lint/cmd/[email protected]
15+
RUN golangci-lint --version
16+
17+
RUN golangci-lint run || echo "Linter failed"
18+
19+
ENTRYPOINT ["/workdir/main"]

Makefile

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,7 @@
11
.PHONY: build
22
build:
3-
DOCKER_BUILDKIT=1 docker build -t main .
3+
docker build -t main .
44

55
.PHONY: run
66
run: build
77
docker run main
8-
9-
.PHONY: lint-v1.43
10-
lint-v1.43:
11-
@docker run --rm -it \
12-
-v $$(pwd):/app \
13-
-w /app \
14-
golangci/golangci-lint:v1.43-alpine \
15-
sh -c "golangci-lint run" || echo "Linter failed"
16-
17-
.PHONY: lint-v1.44
18-
lint-v1.44:
19-
@docker run --rm -it \
20-
-v $$(pwd):/app \
21-
-w /app \
22-
golangci/golangci-lint:v1.44-alpine \
23-
sh -c "golangci-lint run" || echo "Linter failed"

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,14 @@ $ make run
1212

1313
## Reproducing the Error
1414

15+
UPDATE: The problem is because this example relies on a library that uses CGO
16+
to wrap the Proj library.
17+
As the library was not installed locally, the export files weren't generated
18+
by the GC compiler.
19+
I've since modified the Dockerfile to install golangci-lint v1.50.1 and ran
20+
golangci-lint within the container itself and the error no longer appears.
21+
22+
1523
```shell
1624
$ golangci-lint --version
1725
golangci-lint has version 1.50.1 built from 8926a95f on 2022-10-22T10:50:47Z

0 commit comments

Comments
 (0)