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

Temporary builds are not cleaned up with wgo #10

Closed
depado opened this issue May 13, 2024 · 2 comments
Closed

Temporary builds are not cleaned up with wgo #10

depado opened this issue May 13, 2024 · 2 comments

Comments

@depado
Copy link

depado commented May 13, 2024

Hi!
First of all thanks for the great tool! 🔥

I'm facing an issue but I don't really know how to debug it. Basically when I use wgo for a long time my /tmp directory gets full and this errors pops-up:

/usr/lib/go/pkg/tool/linux_amd64/link: running gcc failed: exit status 1
/usr/bin/ld: final link failed: No space left on device
collect2: error: ld returned 1 exit status

At first I thought it had something to do with #8 because I'm also using templ (although not in the same way) but it seems that's not the case. Example commands I'm using:

$ wgo -file=.go -file=.templ -xfile=_templ.go templ generate :: \
	bun run tailwindcss -m -i ./assets/tailwind.css -o ./assets/dist/styles.min.css :: \
	go run main.go serve
$ wgo -file=.go -file=.templ -xfile=_templ.go go run main.go serve

Unsure if that's related but I also use make to run these. I tried both with and without make and the results are the same. After a while, my /tmp directory looks like this:

image

Maybe I'm doing something wrong?

@bokwoon95
Copy link
Owner

To be honest this has been affecting me as well (my computer has like 171 go-buildxxxx directories at this moment), but I've never run out of storage space from this before. How much space does your PC have? What does the output of this show?

du -s /tmp/go-build* | awk '{ sum += $1 } END { print sum }'

Mine shows 6143896, which is 6 gigabytes (!).

It seems like go build sometimes doesn't clean up the temp go-buildxxxx directories if it is interrupted (and wgo interrupts go build a lot every time a file event occurs but go build is still running). The vscode-go extension seems to be affected also. You're probably just seeing this now because wgo invokes (and interrupts) go build a lot more often than if you had ran the command manually.

golang/go #25808: cmd/go: install/build doesn't remove temporary files when aborted
microsoft/vscode-go #2173: a lot of /tmp/go-build* files.
golang/vscode-go #152: bug: leftover temporary directories (/tmp/go-build*, /tmp/vscode-go*)
golang/go #39382: cmd/go: remove temporary build directories when terminated by signal
golang/go #41331: x/tools/gopls: creates many /tmp/go-build* directories

I think you would have to run rm -rf /tmp/go-build* every once in a while.

@depado
Copy link
Author

depado commented May 14, 2024

Hi!
Thanks for the quick reply. This confirms my suspicions. My /tmp is a separate partition with 7GB storage and it indeed fills up after a long dev session with lots of restarts (when I faced this issue I had almost 350 go-build* in there). I opened this issue thinking maybe I was doing something wrong and also tell you about the potential issue if you weren't aware of it, but that's an issue I can live with 😄

@depado depado closed this as completed May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants