Description: Use the same tempdir to check across function
Author: Nilesh Patra <nilesh@iki.fi>
Last-Update: 2024-07-07
--- a/bgzf/bgzf_test.go
+++ b/bgzf/bgzf_test.go
@@ -108,12 +108,13 @@
 
 	if runtime.GOOS != "windows" {
 		// NOTE: on Windows, os.Open is not allowed for directories.
-		f, err = os.Open(t.TempDir())
+		tempdir := t.TempDir()
+		f, err = os.Open(tempdir)
 		if err != nil {
 			t.Fatalf("Open temp dir: %v", err)
 		}
 		ok, err = HasEOF(f)
-		if want := "read " + t.TempDir() + ": is a directory"; err.Error() != want {
+		if want := "read " + tempdir + ": is a directory"; err.Error() != want {
 			t.Errorf("Expected error:%s got:%v", want, err)
 		}
 		if ok {
