Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Try a temporary directory if the user cache fails
Since commit 58c17f6 ("addr.Suggest should lock a file instead of memory"), pkg/internal/testing/addr/manager.go’s init() function tries to create a directory using either os.UserCacheDir() or os.TempDir(), whichever succeeds first. In many build environments, $HOME is non-empty but points to an unusable directory; in such cases, os.UserCacheDir() returns an unusable directory, which causes init() to panic. This changes init() to first try os.UserCacheDir(), including creating the desired directory; if that fails, the whole operation is tried again with os.TempDir(). Signed-off-by: Stephen Kitt <[email protected]>
- Loading branch information