Skip to content

Commit 5da2e26

Browse files
committed
printf debugging
1 parent ad069eb commit 5da2e26

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

plugin/xdg.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,17 @@ func (p xdgPath) homeDir(path string) string {
4747
func (p xdgPath) writable(path string) bool {
4848
// The easiest cross-platform way to check if it is writable is
4949
// to just create a directory and then remove it.
50-
tempDir, err := os.MkdirTemp(path, ".conftestcheck-")
50+
tempDir, err := os.MkdirTemp(path, "conftestcheck")
5151
if err != nil {
52+
53+
fmt.Fprintln(os.Stderr, "dir is not writable:", path)
54+
5255
return false
5356
}
5457
os.RemoveAll(tempDir)
58+
59+
fmt.Fprintln(os.Stderr, "dir IS writable:", filepath.Join(path, "conftestcheck"))
60+
5561
return true
5662
}
5763

plugin/xdg_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func TestPreferred(t *testing.T) {
4343
name: "should return XDG_DATA_HOME if both XDG_DATA_HOME and XDG_DATA_DIRS is set",
4444
path: pluginsDir,
4545
xdgDataHome: tempDir,
46-
xdgDataDirs: "/tmp2:/tmp3",
46+
xdgDataDirs: filepath.Join(tempDir, "subdir123"),
4747
want: filepath.ToSlash(filepath.Join(tempDir, conftestDir, pluginsDir)),
4848
},
4949
{

0 commit comments

Comments
 (0)