Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

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.

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.

1 participant