Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cmd/cue: use CUE_CACHE_DIR instead of CUE_MODCACHE
We borrowed CUE_MODCACHE from Go's GOMODCACHE, as a temporary place on disk to cache downloaded CUE modules. CUE_MODCACHE works fine on its own, but there is a high probability that we will want to cache other files in the future, much like Go started with a build cache and later added test and modules caches. Rather than needing to add more environment variables in the future for other types of cached data we might want to support, use CUE_CACHE_DIR as a parent directory for all CUE cache directories, and place the module cache at ${CUE_CACHE_DIR}/mod. We choose an abbreviated name for the directory as it is already common elsewhere in CUE, and it keeps paths a little bit shorter. This also mirrors CUE_CONFIG_DIR, which is also designed this way as a parent directory to hold any number of future configuration files. This is technically a breaking change, but CUE_MODCACHE was only just introduced in v0.8.0-alpha.1, so we can change it for v0.8.0-alpha.2. Centralize getting CUE_CONFIG_DIR and CUE_CACHE_DIR with their defaults into common.go as well, for easier reuse, and use sync.OnceValues since we only need to call Getenv and UserConfigDir/UserCacheDir once. While here, I noticed that `cue help environment` had a tiny mistake in the documentation of CUE_CONFIG_DIR, as on MacOS it lacked the "cue" base directory at the end. Fixes #2833. Signed-off-by: Daniel Martí <mvdan@mvdan.cc> Change-Id: Ib1c908d6b6e0ec224931ddd9007e91963348e712 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1177047 Reviewed-by: Roger Peppe <rogpeppe@gmail.com> Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com> TryBot-Result: CUEcueckoo <cueckoo@gmail.com>
- Loading branch information
Showing
11 changed files
with
46 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters