-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
cmd/go: mod vendor fails with unlinkat error #38998
Comments
Thanks for filing. What is the docker command you're using to build? My guess is that you're mounting a local module cache into the container, which is readonly. (see #27161) |
Couldn't reproduce this with Docker on macOS. Could you give a more minimal example that reproduces the problem? There's a moderately sized Makefile here, and I don't know whether it's doing something that might cause issues. Is there any chance that more than one instance of |
@toothrot This is the command I'm using to build: |
@jayconrod I've looked into Makefile.common and from what I see I don't think there is more than one instance of go mod vendor running when I start the build. I have to admit I don't quite understand you when you say 'Could you give a more minimal example that reproduces the problem?'. The make file I use is the one that's already there as it came with go sources. I don't want to mess with it. |
@toothroot @jayconrod Temporarily I'm avoiding this problem by removing 'unused' flag in Makefile.common. I have replaced the original line in Makefile.common: common-all: precheck style check_license lint unused build test with common-all: precheck style check_license lint build test so that 'go mod vendor' is not getting executed. I did it by putting this line in my Docker file (before calling make): RUN sed -i 's/precheck style check_license lint unused build test/precheck style check_license lint build test/g' Makefile.common Now the make goes on without 'go mod vendor' error about directory not being empty. |
I'm wondering if there's a way to reproduce this using a few From the error message, it sounds like something is writing files in the I tried this on a couple systems, but I still couldn't reproduce the failure you're seeing. It does however fail with:
|
@jayconrod Thanks for answering. Regarding the race error you mentioned, I've also bumped into it. I have worked around it by removing - race flag frm the Makefile.common file. I know it's not the solution but it enabled me to go on with the build. The 'go mod vendor' problem I avoided by removing the flag unused from the Makefile.common file. Again, not the solution but after that I was able to build blackbox_exporter. |
The link error looks like #14481, fixed in |
Closing since we haven't been able to reproduce this, and there doesn't seem to be a way to move forward. |
delete vendor folder then docker-compose exec [container] go mod vendor |
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Yes.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
I'm trying to build blackbox_exporter within Docker container. I have successfully built it on my CentOS 7 system, now I'm trying to build it in Docker container.
My Dockerfile is:
FROM golang:1.13-alpine AS go
RUN mkdir -p /app/blackbox-exporter
WORKDIR /app/blackbox-exporter
RUN apk add --update --no-cache git curl make gcc libc-dev
ENV PATH $PATH:/go/bin
RUN git clone https://github.com/prometheus/blackbox_exporter.git /app/blackbox-exporter
RUN make
What did you expect to see?
I expect to see no errors when building blackbox_exporter in Docker container.
What did you see instead?
Instead I get the following error:
>> running check for unused packages in vendor/
GO111MODULE=on go mod vendor
go mod vendor: unlinkat /app/blackbox-exporter/vendor/github.com/alecthomas/template/parse: directory not empty
make: *** [/app/blackbox-exporter/Makefile.common:204: common-unused] Error 1
The command '/bin/sh -c make -f /app/blackbox-exporter/blackbox-exporter-makefile' returned a non-zero code: 2
The text was updated successfully, but these errors were encountered: