Skip to content

Commit

Permalink
gopls/internal/lsp/filecache: GOPLS_CACHE -> GOPLSCACHE
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
adonovan committed Mar 6, 2023
1 parent d566927 commit b72edd1
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion gopls/internal/lsp/filecache/filecache.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -161,7 +164,7 @@ func filename(kind string, key [32]byte) string {
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()
Expand Down

0 comments on commit b72edd1

Please sign in to comment.