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: go clean does not remove .exe file for main built by "go build sub/pkg" #52979
Comments
I don't think this is expected to work,
|
This is a somewhat terse reply. What is the user expected to do with this? DIR? So how is that supposed to be used? PLease be a little more helpful |
It sounds like you want |
Thanks @ianlancetaylor, tried that, didn't work for me unfortunately |
If this doesnt work, I don't see why this issue was closed so swiftly without proper investigation and explanation, especially when information is lacking in the docs. How does one remove an exe built from a target not in the root dir of a module? |
Thanks @ianlancetaylor. |
I've tried using trying other build tools (like make or go-task) to do this, but they all depend on go clean working. |
This is definitely in line with the documentation (https://cs.opensource.google/go/go/+/master:src/cmd/go/internal/clean/clean.go;l=37-39;drc=d60ad1e068263832c711aaf17b6ccb1b7f71b000). Emphasis mine:
None of the entries in the list includes subpackages. It would be possible to expand that list, of course, but I think it's already too aggressive (and the Other options you might consider are:
For example:
|
Thanks @bcmills. I will take a look at your directory solution (I'm giving up on trying building on windows, windows support just seem to be lacking in so many areas, and is a second class citizen, so I'll have to use WSL instead). That link you posted does not appear to be open source, I just get permission denied when I follow it. Is there another open source link which porvides access to this documentation that I should probably read? |
The corresponding link on github: go/src/cmd/go/internal/clean/clean.go Lines 37 to 39 in b93ceef
|
A potentially expensive way of doing this: read the buildinfo out of any file that we might want to remove, and verify it matches a (main) package in the current module |
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?
A module with a main package in a sub package at ./src/app.
foo
module structurego.mod:
main.go:
This should create app.exe at the root:
Then run
Nothing happens
Use the -n option:
So where is app.exe in this list? Why does this not work for a sub-package?
If this is by design, then what is the correct way of doing the clean for sub-packages.
Referring to the go docs at go clean, does not shed any light on this issue.
The following additional options have been tried:
... has no effect
The other options modcache, cache and testcache all seem like nuclear options
Googling around for this has served up no effective solution, so raising this issue is my last resort.
What did you expect to see?
Built exe file to be deleted
What did you see instead?
already explained above
The text was updated successfully, but these errors were encountered: