Skip to content

Comments

hack: allow building golangci from source for custom versions#5848

Merged
tonistiigi merged 1 commit intomoby:masterfrom
tonistiigi:golangci-source
Apr 7, 2025
Merged

hack: allow building golangci from source for custom versions#5848
tonistiigi merged 1 commit intomoby:masterfrom
tonistiigi:golangci-source

Conversation

@tonistiigi
Copy link
Member

@tonistiigi tonistiigi commented Mar 18, 2025

I wrote this to help bisect the lint error in #5814

 > [golangci-lint 1/1] RUN --mount=target=/go/src/github.com/moby/buildkit     --mount=target=/root/.cache,type=cache,id=lint-cache-${TARGETNAME}-linux/s390x   xx-go --wrap &&   golangci-lint run --build-tags "${BUILDTAGS}" &&   touch /golangci-lint.done:
6.996 level=error msg="[linters_context] gocritic: load embedded ruleguard rules: rules/rules.go:13: can't load fmt: setting an explicit GOROOT can fix this problem"
------
lint.Dockerfile:47
--------------------

Fails in v1.64.2+, Passes in v1.63.4 . Note failures are for s390x. Both work fine for amd64/arm64.

But, when building from source then all latest versions pass as well 🤷‍♂️ . The issue in #5814 only appears when using their releases. I guess if we can't figure this out, then one option is to switch CI to source-built linter.

@github-actions github-actions bot added the area/hack building buildkit itself label Mar 18, 2025
@tonistiigi
Copy link
Member Author

changed the build stage to

#RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/ go mod download
#RUN --mount=type=cache,target=/go/pkg/mod --mount=type=cache,target=/root/.cache/ mkdir -p out && go build -o /out/golangci-lint ./cmd/golangci-lint
ARG BUILDARCH
RUN wget https://github.com/golangci/golangci-lint/releases/download/v1.64.8/golangci-lint-1.64.8-linux-${BUILDARCH}.tar.gz
RUN tar xvf golangci-lint-1.64.8-linux-${BUILDARCH}.tar.gz
RUN mkdir -p /out && mv golangci-lint-1.64.8-linux-arm64/golangci-lint /out/golangci-lint

For test and now it fails. So has to be something wrong with the way the release binary was built.

Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
@thompson-shaun thompson-shaun added this to the v0.21.0 milestone Apr 7, 2025
@tonistiigi tonistiigi merged commit 8540ef4 into moby:master Apr 7, 2025
109 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/hack building buildkit itself

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants