polyfloyd / go-errorlint

A source code linter that can be used to find code that will cause problems with Go's error wrapping scheme
MIT License
249 stars 19 forks source link

Publish docker image #1

Closed jeanlucmongrain closed 4 years ago

jeanlucmongrain commented 4 years ago

please create a docker image and publish it, it will be great to use it for CI build steps

here the dockerfile I used, feel free to use it

FROM golang:1.14.2-alpine3.11 as builder

RUN apk add --no-cache git && \
    go get -v github.com/polyfloyd/go-errorlint

FROM golang:1.14.2-alpine3.11

COPY --from=builder /go/bin/go-errorlint /usr/local/bin/errorlint

ENTRYPOINT ["/usr/local/bin/errorlint"]
polyfloyd commented 4 years ago

Hi Bruno, thank your for your comment :)

Hmm, I am not familiar with a pattern where individual CI tools are packaged as Docker containers. Which environments make use of this pattern and what would be the advantages?

If you are concerned about having to build the tool every run and are relying on Docker to cache the built binary, I think pre-built binaries from Github Releases are a better solution.

Maintaining a Docker container also creates an additional maintenance burden on a new platform, something I am not interested in.

jeanlucmongrain commented 4 years ago

Many CI are now using only docker images for each build steps.

the same reason golangci-lint is also shipped as a docker image

mcristina422 commented 4 years ago

Personally I'd rather see it implemented as a customer linter than published separately as a container. https://github.com/golangci/golangci-lint/issues/1030

Looking through the code it looks like it could be updated pretty easily to support it

jeanlucmongrain commented 4 years ago

Looking through the code it looks like it could be updated pretty easily to support it

that is the best, but you will need to move the linting logic out of your package main into a sub pkg to allow golangci-lint to import it and call it

polyfloyd commented 4 years ago

Integrating with golangci-lint is something I will be happy to support. I'll start by moving the linters to a new package as @bclermont mentioned.

Let's continue this conversation on golangci/golangci-lint#1030