diff --git a/encoding/gcompress/gcompress_z_unit_gzip_test.go b/encoding/gcompress/gcompress_z_unit_gzip_test.go index 2e43558fa..77bb4fc95 100644 --- a/encoding/gcompress/gcompress_z_unit_gzip_test.go +++ b/encoding/gcompress/gcompress_z_unit_gzip_test.go @@ -44,8 +44,8 @@ func Test_Gzip_UnGzip(t *testing.T) { func Test_Gzip_UnGzip_File(t *testing.T) { srcPath := gdebug.TestDataPath("gzip", "file.txt") - dstPath1 := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr(), "gzip.zip") - dstPath2 := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr(), "file.txt") + dstPath1 := gfile.TempDir(gtime.TimestampNanoStr(), "gzip.zip") + dstPath2 := gfile.TempDir(gtime.TimestampNanoStr(), "file.txt") // Compress. gtest.C(t, func(t *gtest.T) { diff --git a/encoding/gcompress/gcompress_z_unit_zip_test.go b/encoding/gcompress/gcompress_z_unit_zip_test.go index 757675b20..fce4d4b51 100644 --- a/encoding/gcompress/gcompress_z_unit_zip_test.go +++ b/encoding/gcompress/gcompress_z_unit_zip_test.go @@ -29,7 +29,7 @@ func Test_ZipPath(t *testing.T) { t.Assert(gfile.Exists(dstPath), true) defer gfile.Remove(dstPath) - tempDirPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + tempDirPath := gfile.TempDir(gtime.TimestampNanoStr()) err = gfile.Mkdir(tempDirPath) t.Assert(err, nil) @@ -58,7 +58,7 @@ func Test_ZipPath(t *testing.T) { t.Assert(gfile.Exists(dstPath), true) defer gfile.Remove(dstPath) - tempDirPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + tempDirPath := gfile.TempDir(gtime.TimestampNanoStr()) err = gfile.Mkdir(tempDirPath) t.Assert(err, nil) @@ -93,7 +93,7 @@ func Test_ZipPath(t *testing.T) { t.Assert(gfile.Exists(dstPath), true) defer gfile.Remove(dstPath) - tempDirPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + tempDirPath := gfile.TempDir(gtime.TimestampNanoStr()) err = gfile.Mkdir(tempDirPath) t.Assert(err, nil) @@ -131,7 +131,7 @@ func Test_ZipPathWriter(t *testing.T) { t.Assert(err, nil) t.AssertGT(writer.Len(), 0) - tempDirPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + tempDirPath := gfile.TempDir(gtime.TimestampNanoStr()) err = gfile.Mkdir(tempDirPath) t.Assert(err, nil) diff --git a/frame/gins/gins_z_unit_config_test.go b/frame/gins/gins_z_unit_config_test.go index 4e1bc4a6e..2ab5bf0c0 100644 --- a/frame/gins/gins_z_unit_config_test.go +++ b/frame/gins/gins_z_unit_config_test.go @@ -39,7 +39,7 @@ func Test_Config2(t *testing.T) { // relative path gtest.C(t, func(t *gtest.T) { var err error - dirPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + dirPath := gfile.TempDir(gtime.TimestampNanoStr()) err = gfile.Mkdir(dirPath) t.Assert(err, nil) defer gfile.Remove(dirPath) @@ -63,7 +63,7 @@ func Test_Config2(t *testing.T) { // relative path, config folder gtest.C(t, func(t *gtest.T) { var err error - dirPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + dirPath := gfile.TempDir(gtime.TimestampNanoStr()) err = gfile.Mkdir(dirPath) t.Assert(err, nil) defer gfile.Remove(dirPath) @@ -89,7 +89,7 @@ func Test_Config2(t *testing.T) { func Test_Config3(t *testing.T) { gtest.C(t, func(t *gtest.T) { var err error - dirPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + dirPath := gfile.TempDir(gtime.TimestampNanoStr()) err = gfile.Mkdir(dirPath) t.Assert(err, nil) defer gfile.Remove(dirPath) @@ -113,7 +113,7 @@ func Test_Config3(t *testing.T) { gtest.C(t, func(t *gtest.T) { var err error - dirPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + dirPath := gfile.TempDir(gtime.TimestampNanoStr()) err = gfile.Mkdir(dirPath) t.Assert(err, nil) defer gfile.Remove(dirPath) diff --git a/frame/gins/gins_z_unit_database_test.go b/frame/gins/gins_z_unit_database_test.go index 44ea6c22c..ce85196f9 100644 --- a/frame/gins/gins_z_unit_database_test.go +++ b/frame/gins/gins_z_unit_database_test.go @@ -23,7 +23,7 @@ func Test_Database(t *testing.T) { ) gtest.C(t, func(t *gtest.T) { var err error - dirPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + dirPath := gfile.TempDir(gtime.TimestampNanoStr()) err = gfile.Mkdir(dirPath) t.Assert(err, nil) defer gfile.Remove(dirPath) diff --git a/frame/gins/gins_z_unit_redis_test.go b/frame/gins/gins_z_unit_redis_test.go index 0a7e6a86d..3619b1dd5 100644 --- a/frame/gins/gins_z_unit_redis_test.go +++ b/frame/gins/gins_z_unit_redis_test.go @@ -24,7 +24,7 @@ func Test_Redis(t *testing.T) { gtest.C(t, func(t *gtest.T) { var err error - dirPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + dirPath := gfile.TempDir(gtime.TimestampNanoStr()) err = gfile.Mkdir(dirPath) t.Assert(err, nil) defer gfile.Remove(dirPath) diff --git a/net/ghttp/ghttp_unit_log_test.go b/net/ghttp/ghttp_unit_log_test.go index aca814df0..496002c00 100644 --- a/net/ghttp/ghttp_unit_log_test.go +++ b/net/ghttp/ghttp_unit_log_test.go @@ -23,7 +23,7 @@ import ( func Test_Log(t *testing.T) { gtest.C(t, func(t *gtest.T) { - logDir := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + logDir := gfile.TempDir(gtime.TimestampNanoStr()) p := ports.PopRand() s := g.Server(p) s.BindHandler("/hello", func(r *ghttp.Request) { diff --git a/net/ghttp/ghttp_unit_param_file_test.go b/net/ghttp/ghttp_unit_param_file_test.go index 1d5b9ac2c..dbb952d2e 100644 --- a/net/ghttp/ghttp_unit_param_file_test.go +++ b/net/ghttp/ghttp_unit_param_file_test.go @@ -21,7 +21,7 @@ import ( ) func Test_Params_File_Single(t *testing.T) { - dstDirPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + dstDirPath := gfile.TempDir(gtime.TimestampNanoStr()) p := ports.PopRand() s := g.Server(p) s.BindHandler("/upload/single", func(r *ghttp.Request) { @@ -75,7 +75,7 @@ func Test_Params_File_Single(t *testing.T) { } func Test_Params_File_CustomName(t *testing.T) { - dstDirPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + dstDirPath := gfile.TempDir(gtime.TimestampNanoStr()) p := ports.PopRand() s := g.Server(p) s.BindHandler("/upload/single", func(r *ghttp.Request) { @@ -112,7 +112,7 @@ func Test_Params_File_CustomName(t *testing.T) { } func Test_Params_File_Batch(t *testing.T) { - dstDirPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + dstDirPath := gfile.TempDir(gtime.TimestampNanoStr()) p := ports.PopRand() s := g.Server(p) s.BindHandler("/upload/batch", func(r *ghttp.Request) { diff --git a/os/gcfg/gcfg_z_unit_test.go b/os/gcfg/gcfg_z_unit_test.go index bd2fc94e5..347cebcc8 100644 --- a/os/gcfg/gcfg_z_unit_test.go +++ b/os/gcfg/gcfg_z_unit_test.go @@ -362,7 +362,7 @@ func TestCfg_FilePath(t *testing.T) { func TestCfg_Get(t *testing.T) { gtest.C(t, func(t *gtest.T) { var err error - configPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + configPath := gfile.TempDir(gtime.TimestampNanoStr()) err = gfile.Mkdir(configPath) t.Assert(err, nil) defer gfile.Remove(configPath) diff --git a/os/gfile/gfile_z_copy_test.go b/os/gfile/gfile_z_copy_test.go index d45a096d1..d66ecdb5d 100644 --- a/os/gfile/gfile_z_copy_test.go +++ b/os/gfile/gfile_z_copy_test.go @@ -49,8 +49,8 @@ func Test_CopyFile(t *testing.T) { }) // Content replacement. gtest.C(t, func(t *gtest.T) { - src := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) - dst := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + src := gfile.TempDir(gtime.TimestampNanoStr()) + dst := gfile.TempDir(gtime.TimestampNanoStr()) srcContent := "1" dstContent := "1" gfile.PutContents(src, srcContent) @@ -115,8 +115,8 @@ func Test_CopyDir(t *testing.T) { }) // Content replacement. gtest.C(t, func(t *gtest.T) { - src := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr(), gtime.TimestampNanoStr()) - dst := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr(), gtime.TimestampNanoStr()) + src := gfile.TempDir(gtime.TimestampNanoStr(), gtime.TimestampNanoStr()) + dst := gfile.TempDir(gtime.TimestampNanoStr(), gtime.TimestampNanoStr()) srcContent := "1" dstContent := "1" gfile.PutContents(src, srcContent) diff --git a/os/gfpool/gfpool_z_unit_concurrent_test.go b/os/gfpool/gfpool_z_unit_concurrent_test.go index 4b52c4668..4391118d7 100644 --- a/os/gfpool/gfpool_z_unit_concurrent_test.go +++ b/os/gfpool/gfpool_z_unit_concurrent_test.go @@ -12,7 +12,7 @@ import ( func Test_ConcurrentOS(t *testing.T) { gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) defer gfile.Remove(path) f1, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC|os.O_APPEND, 0666) t.Assert(err, nil) @@ -43,7 +43,7 @@ func Test_ConcurrentOS(t *testing.T) { }) gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) defer gfile.Remove(path) f1, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC|os.O_APPEND, 0666) t.Assert(err, nil) @@ -64,7 +64,7 @@ func Test_ConcurrentOS(t *testing.T) { t.Assert(gstr.Count(gfile.GetContents(path), "@1234567890#"), 2000) }) gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) defer gfile.Remove(path) f1, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC|os.O_APPEND, 0666) t.Assert(err, nil) @@ -92,7 +92,7 @@ func Test_ConcurrentOS(t *testing.T) { }) // DATA RACE //gtest.C(t, func(t *gtest.T) { - // path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + // path := gfile.TempDir(gtime.TimestampNanoStr()) // defer gfile.Remove(path) // f1, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC|os.O_APPEND, 0666) // t.Assert(err, nil) @@ -130,7 +130,7 @@ func Test_ConcurrentOS(t *testing.T) { func Test_ConcurrentGFPool(t *testing.T) { gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) defer gfile.Remove(path) f1, err := gfpool.Open(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC|os.O_APPEND, 0666) t.Assert(err, nil) @@ -152,7 +152,7 @@ func Test_ConcurrentGFPool(t *testing.T) { }) // DATA RACE //gtest.C(t, func(t *gtest.T) { - // path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + // path := gfile.TempDir(gtime.TimestampNanoStr()) // defer gfile.Remove(path) // f1, err := gfpool.Open(path, os.O_RDWR|os.O_CREATE|os.O_TRUNC|os.O_APPEND, 0666) // t.Assert(err, nil) diff --git a/os/gfsnotify/gfsnotify_z_unit_test.go b/os/gfsnotify/gfsnotify_z_unit_test.go index a4640bda2..46b8a39e0 100644 --- a/os/gfsnotify/gfsnotify_z_unit_test.go +++ b/os/gfsnotify/gfsnotify_z_unit_test.go @@ -21,7 +21,7 @@ import ( func TestWatcher_AddOnce(t *testing.T) { gtest.C(t, func(t *gtest.T) { value := gtype.New() - path := gfile.Join(gfile.TempDir(), gconv.String(gtime.TimestampNano())) + path := gfile.TempDir(gconv.String(gtime.TimestampNano())) err := gfile.PutContents(path, "init") t.Assert(err, nil) defer gfile.Remove(path) diff --git a/os/glog/glog_z_unit_chaining_test.go b/os/glog/glog_z_unit_chaining_test.go index 961278173..d6360cce7 100644 --- a/os/glog/glog_z_unit_chaining_test.go +++ b/os/glog/glog_z_unit_chaining_test.go @@ -29,7 +29,7 @@ func Test_To(t *testing.T) { func Test_Path(t *testing.T) { gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) err := gfile.Mkdir(path) @@ -47,7 +47,7 @@ func Test_Path(t *testing.T) { func Test_Cat(t *testing.T) { gtest.C(t, func(t *gtest.T) { cat := "category" - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) err := gfile.Mkdir(path) @@ -64,7 +64,7 @@ func Test_Cat(t *testing.T) { func Test_Level(t *testing.T) { gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) err := gfile.Mkdir(path) @@ -81,7 +81,7 @@ func Test_Level(t *testing.T) { func Test_Skip(t *testing.T) { gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) err := gfile.Mkdir(path) @@ -99,7 +99,7 @@ func Test_Skip(t *testing.T) { func Test_Stack(t *testing.T) { gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) err := gfile.Mkdir(path) @@ -117,7 +117,7 @@ func Test_Stack(t *testing.T) { func Test_StackWithFilter(t *testing.T) { gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) err := gfile.Mkdir(path) @@ -131,7 +131,7 @@ func Test_StackWithFilter(t *testing.T) { t.Assert(gstr.Count(content, "Stack"), 1) }) gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) err := gfile.Mkdir(path) @@ -148,7 +148,7 @@ func Test_StackWithFilter(t *testing.T) { func Test_Header(t *testing.T) { gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) err := gfile.Mkdir(path) @@ -161,7 +161,7 @@ func Test_Header(t *testing.T) { t.Assert(gstr.Count(content, "1 2 3"), 1) }) gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) err := gfile.Mkdir(path) @@ -177,7 +177,7 @@ func Test_Header(t *testing.T) { func Test_Line(t *testing.T) { gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) err := gfile.Mkdir(path) @@ -192,7 +192,7 @@ func Test_Line(t *testing.T) { t.Assert(gstr.Contains(content, gfile.Separator), true) }) gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) err := gfile.Mkdir(path) @@ -210,7 +210,7 @@ func Test_Line(t *testing.T) { func Test_Async(t *testing.T) { gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) err := gfile.Mkdir(path) @@ -228,7 +228,7 @@ func Test_Async(t *testing.T) { }) gtest.C(t, func(t *gtest.T) { - path := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + path := gfile.TempDir(gtime.TimestampNanoStr()) file := fmt.Sprintf(`%d.log`, gtime.TimestampNano()) err := gfile.Mkdir(path) diff --git a/os/glog/glog_z_unit_concurrent_test.go b/os/glog/glog_z_unit_concurrent_test.go index 0197cf9f4..1378e2278 100644 --- a/os/glog/glog_z_unit_concurrent_test.go +++ b/os/glog/glog_z_unit_concurrent_test.go @@ -22,7 +22,7 @@ func Test_Concurrent(t *testing.T) { l := glog.New() s := "@1234567890#" f := "test.log" - p := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + p := gfile.TempDir(gtime.TimestampNanoStr()) t.Assert(l.SetPath(p), nil) defer gfile.Remove(p) wg := sync.WaitGroup{} diff --git a/os/glog/glog_z_unit_rotate_test.go b/os/glog/glog_z_unit_rotate_test.go index 941af4280..a7dbefeae 100644 --- a/os/glog/glog_z_unit_rotate_test.go +++ b/os/glog/glog_z_unit_rotate_test.go @@ -20,7 +20,7 @@ import ( func Test_Rotate_Size(t *testing.T) { gtest.C(t, func(t *gtest.T) { l := glog.New() - p := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + p := gfile.TempDir(gtime.TimestampNanoStr()) err := l.SetConfigWithMap(g.Map{ "Path": p, "File": "access.log", @@ -58,7 +58,7 @@ func Test_Rotate_Size(t *testing.T) { func Test_Rotate_Expire(t *testing.T) { gtest.C(t, func(t *gtest.T) { l := glog.New() - p := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + p := gfile.TempDir(gtime.TimestampNanoStr()) err := l.SetConfigWithMap(g.Map{ "Path": p, "File": "access.log", diff --git a/os/gproc/gproc_comm.go b/os/gproc/gproc_comm.go index e654325b5..1e81c1ee1 100644 --- a/os/gproc/gproc_comm.go +++ b/os/gproc/gproc_comm.go @@ -43,7 +43,7 @@ var ( commReceiveQueues = gmap.NewStrAnyMap(true) // commPidFolderPath specifies the folder path storing pid to port mapping files. - commPidFolderPath = gfile.Join(gfile.TempDir(), "gproc") + commPidFolderPath = gfile.TempDir("gproc") ) func init() { diff --git a/os/gres/gres_unit_1_test.go b/os/gres/gres_unit_1_test.go index f7b88b0fa..5c185b936 100644 --- a/os/gres/gres_unit_1_test.go +++ b/os/gres/gres_unit_1_test.go @@ -44,7 +44,7 @@ func Test_Pack(t *testing.T) { func Test_PackToFile(t *testing.T) { gtest.C(t, func(t *gtest.T) { srcPath := gdebug.TestDataPath("files") - dstPath := gfile.Join(gfile.TempDir(), gtime.TimestampNanoStr()) + dstPath := gfile.TempDir(gtime.TimestampNanoStr()) err := gres.PackToFile(srcPath, dstPath) t.Assert(err, nil) diff --git a/os/gsession/gsession_storage_file.go b/os/gsession/gsession_storage_file.go index a5063abd5..44363d7f9 100644 --- a/os/gsession/gsession_storage_file.go +++ b/os/gsession/gsession_storage_file.go @@ -35,7 +35,7 @@ type StorageFile struct { } var ( - DefaultStorageFilePath = gfile.Join(gfile.TempDir(), "gsessions") + DefaultStorageFilePath = gfile.TempDir("gsessions") DefaultStorageFileCryptoKey = []byte("Session storage file crypto key!") DefaultStorageFileCryptoEnabled = false DefaultStorageFileLoopInterval = 10 * time.Second