gopls/internal/lsp/filecache: GOPLS_CACHE -> GOPLSCACHE
The go command doesn't use underscores in environment
variables, so nor should gopls.
Also, document the curious phenomenon that du -sh reports
a larger figure than the budget even when the GC is working.
Change-Id: I156255dc528c7bd700cb76545e9d60e2c4d153fc
Reviewed-on: https://go-review.googlesource.com/c/tools/+/473676
Run-TryBot: Alan Donovan <[email protected]>
Reviewed-by: Robert Findley <[email protected]>
TryBot-Result: Gopher Robot <[email protected]>
gopls-CI: kokoro <[email protected]>
diff --git a/gopls/internal/lsp/filecache/filecache.go b/gopls/internal/lsp/filecache/filecache.go
index f48eed9..a510985 100644
--- a/gopls/internal/lsp/filecache/filecache.go
+++ b/gopls/internal/lsp/filecache/filecache.go
@@ -13,6 +13,9 @@
//
// The space budget of the cache can be controlled by [SetBudget].
// Cache entries may be evicted at any time or in any order.
+// Note that "du -sh $GOPLSCACHE" may report a disk usage
+// figure that is rather larger (e.g. 50%) than the budget because
+// it rounds up partial disk blocks.
//
// The Get and Set operations are concurrency-safe.
package filecache
@@ -161,7 +164,7 @@
func getCacheDir() string {
cacheDirOnce.Do(func() {
// Use user's preferred cache directory.
- userDir := os.Getenv("GOPLS_CACHE")
+ userDir := os.Getenv("GOPLSCACHE")
if userDir == "" {
var err error
userDir, err = os.UserCacheDir()