Open myitcv opened 4 months ago
My 2c: the only reason Go ended up with flags like -cache
and -modcache
is that go clean
used to be for cleaning build artifacts from packages. Nowadays, almost noone uses it for that purpose anymore:
Clean removes object files from package source directories.
The go command builds most objects in a temporary directory,
so go clean is mainly concerned with object files left by other
tools or by manual invocations of go build.
I don't think we will ever have a need for such a "clean package build files" command. Even if evaluating a CUE package or building its e.g. wasm artifacts were to produce some sort of build output, that would be in the cache, not in the very same package directory.
For that reason, I think we should go for something like cue clean modcache
, i.e. an argument instead of a flag. Given that all of our caches live under the same directory, we could also provide cue clean allcaches
to delete all of it.
It's also worth noting that "modcache" is an artifact from Go's GOMODCACHE env var, which we do not have, so we can likely come up with a better name like go clean modulecache
or, as a hierarchy, go clean cache/modules
.
or, as a hierarchy,
go clean cache/modules
.
note that this prompted me to file https://github.com/cue-lang/cue/issues/3139.
With #3139 implemented, I think we should support the following commands to clean ${CUE_CACHE_DIR}
:
cue clean all
- clear all cachescue clean mod
- clear all module cachescue clean mod/download
- clear all downloaded modulescue clean mod/extract
- clear all extracted module archivesBasically, either all
to clear everything under ${CUE_CACHE_DIR}
, or an argument for one of the known cache directories underneath.
(nevermind the fact that in an earlier comment I wrote go clean
...)
With #3139 implemented, I think we should support the following commands to clean
${CUE_CACHE_DIR}
:
cue clean all
- clear everythingcue clean mod
- clear all module cachescue clean mod/download
- clear all downloaded modulescue clean mod/extract
- clear all extracted module archivesBasically, either
all
to clear everything under${CUE_CACHE_DIR}
, or an argument for one of the known cache directories underneath.(nevermind the fact that in an earlier comment I wrote
go clean
...)
according to https://github.com/cue-lang/cue/issues/3139, this should have been part of v9.0.0 ? right ?
but the cue clean all
command seems not known to cue v0.9.2 ? ( or am I missing something? )
@ysmaoui this issue is still open - cue clean
has not been added as a command yet.
another remark:
I am trying to cleanup the cache manually ( by deleting the content of the cache folder ) , but it seems that all files of the modules stored in the cache have permissions that block the deletion
is this a known issue?
Yes, the files are marked read-only to discourage users from directly modifying them. This is why we want to add a cue clean
command - to make it easy to clear the cache entries without needing rm -rf
.
In the spirit of
go clean -modcache
: https://go.dev/ref/mod#go-clean-modcacheMore detail to follow