Skip to content
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

os: UserCacheDir has no tests #57638

Open
bcmills opened this issue Jan 5, 2023 · 1 comment
Open

os: UserCacheDir has no tests #57638

bcmills opened this issue Jan 5, 2023 · 1 comment
Labels
help wanted NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Milestone

Comments

@bcmills
Copy link
Member

bcmills commented Jan 5, 2023

os.UserCacheDir was added in https://go.dev/cl/78835 for #22536.

In examining #57630, it seems that this function is not covered by any tests at all. There were none added in https://go.dev/cl/78835, nor in https://go.dev/cl/120757.

It seems like we should at least have some test that verifies that UserCacheDir reports either an error or a directory in which the user is allowed to create files. 😅

(CC @rsc @robpike @ianlancetaylor @bradfitz @griesemer for os)

@bcmills bcmills added Testing An issue that has been verified to require only test changes, not just a test failure. help wanted NeedsFix The path to resolution is known, but the work has not been done. labels Jan 5, 2023
@bcmills bcmills added this to the Backlog milestone Jan 5, 2023
@gopherbot
Copy link

Change https://go.dev/cl/460917 mentions this issue: gopls/internal/lsp/filecache: use TempDir unless MkdirAll(UserCacheDir)

gopherbot pushed a commit to golang/tools that referenced this issue Jan 6, 2023
On the builders, HOME=/ which causes UserCacheDir to be non-writable.
This change attempts to MkdirAll the UserCacheDir and, if that fails,
we fail back to TempDir, which is assumed to exist and be writable.

Updates golang/go#57638

Change-Id: I6eb81c59b50f90a62c103a2511425fa2f24452fa
Reviewed-on: https://go-review.googlesource.com/c/tools/+/460917
Reviewed-by: Bryan Mills <bcmills@google.com>
gopls-CI: kokoro <noreply+kokoro@google.com>
Run-TryBot: Alan Donovan <adonovan@google.com>
Reviewed-by: Robert Findley <rfindley@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Ja7ad added a commit to Ja7ad/go that referenced this issue Jan 17, 2023
Ja7ad added a commit to Ja7ad/go that referenced this issue Jan 18, 2023
error UserCacheDir skipped and empty string cache dir got fatal.

for test write permission in cache dir add mkdir temp.

Fixes golang#57638 golang#57630
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted NeedsFix The path to resolution is known, but the work has not been done. Testing An issue that has been verified to require only test changes, not just a test failure.
Projects
None yet
Development

No branches or pull requests

2 participants