diff --git a/os/gcache/gcache.go b/os/gcache/gcache.go index 8a1c6a3d3..02b8c15f5 100644 --- a/os/gcache/gcache.go +++ b/os/gcache/gcache.go @@ -11,8 +11,9 @@ package gcache import ( "context" - "github.com/gogf/gf/v2/container/gvar" "time" + + "github.com/gogf/gf/v2/container/gvar" ) // Default cache object. diff --git a/os/gcache/gcache_adapter.go b/os/gcache/gcache_adapter.go index c1bc7b452..0921e9101 100644 --- a/os/gcache/gcache_adapter.go +++ b/os/gcache/gcache_adapter.go @@ -8,8 +8,9 @@ package gcache import ( "context" - "github.com/gogf/gf/v2/container/gvar" "time" + + "github.com/gogf/gf/v2/container/gvar" ) // Adapter is the core adapter for cache features implements. diff --git a/os/gcache/gcache_adapter_memory.go b/os/gcache/gcache_adapter_memory.go index 767db7baf..5d1a40d29 100644 --- a/os/gcache/gcache_adapter_memory.go +++ b/os/gcache/gcache_adapter_memory.go @@ -8,13 +8,13 @@ package gcache import ( "context" - "github.com/gogf/gf/v2/container/gvar" "math" "time" "github.com/gogf/gf/v2/container/glist" "github.com/gogf/gf/v2/container/gset" "github.com/gogf/gf/v2/container/gtype" + "github.com/gogf/gf/v2/container/gvar" "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/os/gtimer" ) diff --git a/os/gcache/gcache_adapter_memory_data.go b/os/gcache/gcache_adapter_memory_data.go index ecacaf55c..86af48724 100644 --- a/os/gcache/gcache_adapter_memory_data.go +++ b/os/gcache/gcache_adapter_memory_data.go @@ -7,9 +7,10 @@ package gcache import ( - "github.com/gogf/gf/v2/os/gtime" "sync" "time" + + "github.com/gogf/gf/v2/os/gtime" ) type adapterMemoryData struct { diff --git a/os/gcache/gcache_adapter_memory_expire_sets.go b/os/gcache/gcache_adapter_memory_expire_sets.go index fae11606b..b49678c7c 100644 --- a/os/gcache/gcache_adapter_memory_expire_sets.go +++ b/os/gcache/gcache_adapter_memory_expire_sets.go @@ -7,8 +7,9 @@ package gcache import ( - "github.com/gogf/gf/v2/container/gset" "sync" + + "github.com/gogf/gf/v2/container/gset" ) type adapterMemoryExpireSets struct { diff --git a/os/gcache/gcache_adapter_memory_item.go b/os/gcache/gcache_adapter_memory_item.go index b8c4ee993..5a7862cae 100644 --- a/os/gcache/gcache_adapter_memory_item.go +++ b/os/gcache/gcache_adapter_memory_item.go @@ -14,8 +14,6 @@ import ( func (item *adapterMemoryItem) IsExpired() bool { // Note that it should use greater than or equal judgement here // imagining that the cache time is only 1 millisecond. - if item.e >= gtime.TimestampMilli() { - return false - } - return true + + return item.e < gtime.TimestampMilli() } diff --git a/os/gcache/gcache_adapter_memory_lru.go b/os/gcache/gcache_adapter_memory_lru.go index 6fe91f5ba..cf478996c 100644 --- a/os/gcache/gcache_adapter_memory_lru.go +++ b/os/gcache/gcache_adapter_memory_lru.go @@ -72,12 +72,12 @@ func (lru *adapterMemoryLru) Pop() interface{} { } // Print is used for test only. -//func (lru *adapterMemoryLru) Print() { +// func (lru *adapterMemoryLru) Print() { // for _, v := range lru.list.FrontAll() { // fmt.Printf("%v ", v) // } // fmt.Println() -//} +// } // SyncAndClear synchronizes the keys from `rawList` to `list` and `data` // using Least Recently Used algorithm. diff --git a/os/gcache/gcache_cache.go b/os/gcache/gcache_cache.go index 69221a5a9..b01e53870 100644 --- a/os/gcache/gcache_cache.go +++ b/os/gcache/gcache_cache.go @@ -8,9 +8,10 @@ package gcache import ( "context" + "time" + "github.com/gogf/gf/v2/os/gtimer" "github.com/gogf/gf/v2/util/gconv" - "time" ) // Cache struct. diff --git a/os/gcache/gcache_cache_must.go b/os/gcache/gcache_cache_must.go index 3b9eb0f32..ddb7946df 100644 --- a/os/gcache/gcache_cache_must.go +++ b/os/gcache/gcache_cache_must.go @@ -8,8 +8,9 @@ package gcache import ( "context" - "github.com/gogf/gf/v2/container/gvar" "time" + + "github.com/gogf/gf/v2/container/gvar" ) // MustGet acts like Get, but it panics if any error occurs. diff --git a/os/gcache/gcache_z_example_cache_test.go b/os/gcache/gcache_z_example_cache_test.go index 8b783c153..96b96e3f3 100644 --- a/os/gcache/gcache_z_example_cache_test.go +++ b/os/gcache/gcache_z_example_cache_test.go @@ -2,9 +2,10 @@ package gcache_test import ( "fmt" + "time" + "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gcache" - "time" ) func ExampleNew() { diff --git a/os/gcache/gcache_z_unit_basic_test.go b/os/gcache/gcache_z_unit_basic_test.go index 59ce23a0e..648b2e943 100644 --- a/os/gcache/gcache_z_unit_basic_test.go +++ b/os/gcache/gcache_z_unit_basic_test.go @@ -10,7 +10,6 @@ package gcache_test import ( "context" - "github.com/gogf/gf/v2/util/guid" "math" "testing" "time" @@ -20,6 +19,7 @@ import ( "github.com/gogf/gf/v2/os/gcache" "github.com/gogf/gf/v2/os/grpool" "github.com/gogf/gf/v2/test/gtest" + "github.com/gogf/gf/v2/util/guid" ) var ( @@ -458,7 +458,7 @@ func TestCache_SetConcurrency(t *testing.T) { }() select { case <-time.After(2 * time.Second): - //t.Log("first part end") + // t.Log("first part end") } go func() { @@ -470,7 +470,7 @@ func TestCache_SetConcurrency(t *testing.T) { }() select { case <-time.After(2 * time.Second): - //t.Log("second part end") + // t.Log("second part end") } }) } diff --git a/os/gcfg/gcfg.go b/os/gcfg/gcfg.go index 81259c6b6..df038492a 100644 --- a/os/gcfg/gcfg.go +++ b/os/gcfg/gcfg.go @@ -10,6 +10,7 @@ package gcfg import ( "context" "fmt" + "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/container/gvar" "github.com/gogf/gf/v2/internal/intlog" diff --git a/os/gcfg/gcfg_adapter_file.go b/os/gcfg/gcfg_adapter_file.go index 094a1a10b..f2a15f2ae 100644 --- a/os/gcfg/gcfg_adapter_file.go +++ b/os/gcfg/gcfg_adapter_file.go @@ -8,6 +8,7 @@ package gcfg import ( "context" + "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/container/gvar" diff --git a/os/gcfg/gcfg_adapter_file_content.go b/os/gcfg/gcfg_adapter_file_content.go index 7719b868f..f72f7ff09 100644 --- a/os/gcfg/gcfg_adapter_file_content.go +++ b/os/gcfg/gcfg_adapter_file_content.go @@ -8,6 +8,7 @@ package gcfg import ( "context" + "github.com/gogf/gf/v2/internal/intlog" ) diff --git a/os/gcfg/gcfg_adapter_file_path.go b/os/gcfg/gcfg_adapter_file_path.go index 6eb4f6dc2..c826ed13c 100644 --- a/os/gcfg/gcfg_adapter_file_path.go +++ b/os/gcfg/gcfg_adapter_file_path.go @@ -10,6 +10,7 @@ import ( "bytes" "context" "fmt" + "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/internal/intlog" diff --git a/os/gcfg/gcfg_z_unit_adapter_file_test.go b/os/gcfg/gcfg_z_unit_adapter_file_test.go index e2f8a44d0..c0036a9f0 100644 --- a/os/gcfg/gcfg_z_unit_adapter_file_test.go +++ b/os/gcfg/gcfg_z_unit_adapter_file_test.go @@ -9,9 +9,10 @@ package gcfg_test import ( + "testing" + "github.com/gogf/gf/v2/os/gcfg" "github.com/gogf/gf/v2/test/gtest" - "testing" ) func TestAdapterFile_SetPath(t *testing.T) { diff --git a/os/gcfg/gcfg_z_unit_basic_test.go b/os/gcfg/gcfg_z_unit_basic_test.go index 118ab5bcd..50090421c 100644 --- a/os/gcfg/gcfg_z_unit_basic_test.go +++ b/os/gcfg/gcfg_z_unit_basic_test.go @@ -9,14 +9,13 @@ package gcfg_test import ( - "github.com/gogf/gf/v2/os/gcmd" - "github.com/gogf/gf/v2/os/genv" "testing" - "github.com/gogf/gf/v2/os/gtime" - "github.com/gogf/gf/v2/os/gcfg" + "github.com/gogf/gf/v2/os/gcmd" + "github.com/gogf/gf/v2/os/genv" "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" ) diff --git a/os/gcfg/gcfg_z_unit_instance_test.go b/os/gcfg/gcfg_z_unit_instance_test.go index 81a8c6389..2e7f0dc42 100644 --- a/os/gcfg/gcfg_z_unit_instance_test.go +++ b/os/gcfg/gcfg_z_unit_instance_test.go @@ -10,12 +10,13 @@ package gcfg import ( "context" + "testing" + "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/debug/gdebug" "github.com/gogf/gf/v2/os/genv" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/test/gtest" - "testing" ) var ( diff --git a/os/gcmd/gcmd.go b/os/gcmd/gcmd.go index b84575d48..5c80d0f5f 100644 --- a/os/gcmd/gcmd.go +++ b/os/gcmd/gcmd.go @@ -9,10 +9,11 @@ package gcmd import ( + "os" + "github.com/gogf/gf/v2/container/gvar" "github.com/gogf/gf/v2/internal/command" "github.com/gogf/gf/v2/internal/utils" - "os" ) var ( diff --git a/os/gcmd/gcmd_parser.go b/os/gcmd/gcmd_parser.go index 68d86fb74..9306be1b9 100644 --- a/os/gcmd/gcmd_parser.go +++ b/os/gcmd/gcmd_parser.go @@ -8,17 +8,15 @@ package gcmd import ( - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/internal/json" "os" "strings" - "github.com/gogf/gf/v2/text/gstr" - "github.com/gogf/gf/v2/container/gvar" - + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/text/gregex" + "github.com/gogf/gf/v2/text/gstr" ) // Parser for arguments. diff --git a/os/gcmd/gcmd_z_unit_default_test.go b/os/gcmd/gcmd_z_unit_default_test.go index b38978933..dc570e3c2 100644 --- a/os/gcmd/gcmd_z_unit_default_test.go +++ b/os/gcmd/gcmd_z_unit_default_test.go @@ -9,12 +9,11 @@ package gcmd_test import ( - "github.com/gogf/gf/v2/os/genv" "testing" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gcmd" - + "github.com/gogf/gf/v2/os/genv" "github.com/gogf/gf/v2/test/gtest" ) diff --git a/os/gcmd/gcmd_z_unit_parser_test.go b/os/gcmd/gcmd_z_unit_parser_test.go index 445369d58..7e183542a 100644 --- a/os/gcmd/gcmd_z_unit_parser_test.go +++ b/os/gcmd/gcmd_z_unit_parser_test.go @@ -13,9 +13,7 @@ import ( "testing" "github.com/gogf/gf/v2/container/garray" - "github.com/gogf/gf/v2/os/gcmd" - "github.com/gogf/gf/v2/test/gtest" ) diff --git a/os/gcron/gcron.go b/os/gcron/gcron.go index ed53e0a8a..d1a7ad74e 100644 --- a/os/gcron/gcron.go +++ b/os/gcron/gcron.go @@ -9,9 +9,9 @@ package gcron import ( "context" - "github.com/gogf/gf/v2/os/glog" "time" + "github.com/gogf/gf/v2/os/glog" "github.com/gogf/gf/v2/os/gtimer" ) diff --git a/os/gcron/gcron_entry.go b/os/gcron/gcron_entry.go index 79e13754f..20e371dac 100644 --- a/os/gcron/gcron_entry.go +++ b/os/gcron/gcron_entry.go @@ -8,13 +8,13 @@ package gcron import ( "context" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" "reflect" "runtime" "time" "github.com/gogf/gf/v2/container/gtype" + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/os/gtimer" "github.com/gogf/gf/v2/util/gconv" ) diff --git a/os/gcron/gcron_schedule.go b/os/gcron/gcron_schedule.go index 5827071bd..71da89d95 100644 --- a/os/gcron/gcron_schedule.go +++ b/os/gcron/gcron_schedule.go @@ -7,13 +7,13 @@ package gcron import ( - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/os/gtime" "strconv" "strings" "time" + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/text/gregex" ) diff --git a/os/gcron/gcron_unit_1_test.go b/os/gcron/gcron_unit_1_test.go index 7d666d092..42e4d7552 100644 --- a/os/gcron/gcron_unit_1_test.go +++ b/os/gcron/gcron_unit_1_test.go @@ -8,11 +8,11 @@ package gcron_test import ( "context" - "github.com/gogf/gf/v2/frame/g" "testing" "time" "github.com/gogf/gf/v2/container/garray" + "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gcron" "github.com/gogf/gf/v2/test/gtest" ) @@ -52,7 +52,7 @@ func TestCron_Basic(t *testing.T) { gtest.C(t, func(t *gtest.T) { cron := gcron.New() cron.Add(ctx, "* * * * * *", func(ctx context.Context) {}, "add") - //fmt.Println("start", time.Now()) + // fmt.Println("start", time.Now()) cron.DelayAdd(ctx, time.Second, "* * * * * *", func(ctx context.Context) {}, "delay_add") t.Assert(cron.Size(), 1) time.Sleep(1200 * time.Millisecond) diff --git a/os/gcron/gcron_unit_2_test.go b/os/gcron/gcron_unit_2_test.go index ab05ef129..159197534 100644 --- a/os/gcron/gcron_unit_2_test.go +++ b/os/gcron/gcron_unit_2_test.go @@ -8,11 +8,11 @@ package gcron_test import ( "context" - "github.com/gogf/gf/v2/frame/g" "testing" "time" "github.com/gogf/gf/v2/container/garray" + "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gcron" "github.com/gogf/gf/v2/test/gtest" ) diff --git a/os/genv/genv.go b/os/genv/genv.go index d423d1e0b..0cc9e57c3 100644 --- a/os/genv/genv.go +++ b/os/genv/genv.go @@ -8,11 +8,12 @@ package genv import ( + "os" + "strings" + "github.com/gogf/gf/v2/container/gvar" "github.com/gogf/gf/v2/internal/utils" "github.com/gogf/gf/v2/os/gcmd" - "os" - "strings" ) // All returns a copy of strings representing the environment, diff --git a/os/genv/genv_test.go b/os/genv/genv_test.go index 7c1eef85f..ccdc9e5b7 100644 --- a/os/genv/genv_test.go +++ b/os/genv/genv_test.go @@ -7,11 +7,11 @@ package genv_test import ( - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gcmd" "os" "testing" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gcmd" "github.com/gogf/gf/v2/os/genv" "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" diff --git a/os/gfile/gfile.go b/os/gfile/gfile.go index 3fc6e18b7..d635108c2 100644 --- a/os/gfile/gfile.go +++ b/os/gfile/gfile.go @@ -8,7 +8,6 @@ package gfile import ( - "github.com/gogf/gf/v2/text/gstr" "os" "os/exec" "path/filepath" @@ -16,6 +15,7 @@ import ( "time" "github.com/gogf/gf/v2/container/gtype" + "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" ) diff --git a/os/gfile/gfile_cache.go b/os/gfile/gfile_cache.go index 340831b79..2ed7854d8 100644 --- a/os/gfile/gfile_cache.go +++ b/os/gfile/gfile_cache.go @@ -8,11 +8,12 @@ package gfile import ( "context" + "time" + "github.com/gogf/gf/v2/internal/intlog" "github.com/gogf/gf/v2/os/gcache" "github.com/gogf/gf/v2/os/gcmd" "github.com/gogf/gf/v2/os/gfsnotify" - "time" ) const ( diff --git a/os/gfile/gfile_copy.go b/os/gfile/gfile_copy.go index 9a241f937..eb94647f4 100644 --- a/os/gfile/gfile_copy.go +++ b/os/gfile/gfile_copy.go @@ -7,12 +7,13 @@ package gfile import ( - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" "io" "io/ioutil" "os" "path/filepath" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" ) // Copy file/directory from `src` to `dst`. diff --git a/os/gfile/gfile_home.go b/os/gfile/gfile_home.go index a6137b156..f75de43fe 100644 --- a/os/gfile/gfile_home.go +++ b/os/gfile/gfile_home.go @@ -8,13 +8,14 @@ package gfile import ( "bytes" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" "os" "os/exec" "os/user" "runtime" "strings" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" ) // Home returns absolute path of current user's home directory. diff --git a/os/gfile/gfile_scan.go b/os/gfile/gfile_scan.go index c3e244839..d5b02a370 100644 --- a/os/gfile/gfile_scan.go +++ b/os/gfile/gfile_scan.go @@ -7,12 +7,13 @@ package gfile import ( - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/text/gstr" "os" "path/filepath" "sort" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/text/gstr" ) const ( diff --git a/os/gfile/gfile_search.go b/os/gfile/gfile_search.go index a0ece5ed3..e344aa896 100644 --- a/os/gfile/gfile_search.go +++ b/os/gfile/gfile_search.go @@ -9,10 +9,10 @@ package gfile import ( "bytes" "fmt" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/container/garray" + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" ) // Search searches file by name `name` in following paths with priority: diff --git a/os/gfile/gfile_source.go b/os/gfile/gfile_source.go index 2c7c78a56..4f9726633 100644 --- a/os/gfile/gfile_source.go +++ b/os/gfile/gfile_source.go @@ -7,12 +7,12 @@ package gfile import ( - "github.com/gogf/gf/v2/text/gstr" "os" "runtime" "strings" "github.com/gogf/gf/v2/text/gregex" + "github.com/gogf/gf/v2/text/gstr" ) var ( diff --git a/os/gfile/gfile_z_cache_test.go b/os/gfile/gfile_z_cache_test.go index 22ddec7b6..77e0099e4 100644 --- a/os/gfile/gfile_z_cache_test.go +++ b/os/gfile/gfile_z_cache_test.go @@ -7,12 +7,13 @@ package gfile_test import ( - "github.com/gogf/gf/v2/os/gfile" - "github.com/gogf/gf/v2/test/gtest" "io/ioutil" "os" "testing" "time" + + "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/test/gtest" ) func Test_GetContentsWithCache(t *testing.T) { diff --git a/os/gfile/gfile_z_contents_test.go b/os/gfile/gfile_z_contents_test.go index 488cdfd22..e95f0c68f 100644 --- a/os/gfile/gfile_z_contents_test.go +++ b/os/gfile/gfile_z_contents_test.go @@ -13,10 +13,9 @@ import ( "strings" "testing" - "github.com/gogf/gf/v2/text/gstr" - "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/test/gtest" + "github.com/gogf/gf/v2/text/gstr" ) func createTestFile(filename, content string) error { diff --git a/os/gfile/gfile_z_copy_test.go b/os/gfile/gfile_z_copy_test.go index 3df4cd4b2..6a4ebdfdf 100644 --- a/os/gfile/gfile_z_copy_test.go +++ b/os/gfile/gfile_z_copy_test.go @@ -7,10 +7,11 @@ package gfile_test import ( + "testing" + "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" - "testing" ) func Test_Copy(t *testing.T) { diff --git a/os/gfile/gfile_z_readline_test.go b/os/gfile/gfile_z_readline_test.go index 82f1c273a..1cc860ebd 100644 --- a/os/gfile/gfile_z_readline_test.go +++ b/os/gfile/gfile_z_readline_test.go @@ -7,10 +7,10 @@ package gfile_test import ( - "github.com/gogf/gf/v2/debug/gdebug" - "github.com/gogf/gf/v2/errors/gerror" "testing" + "github.com/gogf/gf/v2/debug/gdebug" + "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/test/gtest" ) diff --git a/os/gfile/gfile_z_scan_test.go b/os/gfile/gfile_z_scan_test.go index e3da18f3f..c64ec62c0 100644 --- a/os/gfile/gfile_z_scan_test.go +++ b/os/gfile/gfile_z_scan_test.go @@ -7,12 +7,11 @@ package gfile_test import ( - "github.com/gogf/gf/v2/container/garray" - "github.com/gogf/gf/v2/debug/gdebug" "testing" + "github.com/gogf/gf/v2/container/garray" + "github.com/gogf/gf/v2/debug/gdebug" "github.com/gogf/gf/v2/os/gfile" - "github.com/gogf/gf/v2/test/gtest" ) diff --git a/os/gfile/gfile_z_size_test.go b/os/gfile/gfile_z_size_test.go index 39d065ec1..f5f97c506 100644 --- a/os/gfile/gfile_z_size_test.go +++ b/os/gfile/gfile_z_size_test.go @@ -7,11 +7,11 @@ package gfile_test import ( - "github.com/gogf/gf/v2/util/gconv" "testing" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/test/gtest" + "github.com/gogf/gf/v2/util/gconv" ) func Test_Size(t *testing.T) { diff --git a/os/gfile/gfile_z_test.go b/os/gfile/gfile_z_test.go index fce200568..60d7bf7ba 100644 --- a/os/gfile/gfile_z_test.go +++ b/os/gfile/gfile_z_test.go @@ -12,11 +12,10 @@ import ( "strings" "testing" - "github.com/gogf/gf/v2/os/gtime" - "github.com/gogf/gf/v2/util/gconv" - "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" + "github.com/gogf/gf/v2/util/gconv" ) func Test_IsDir(t *testing.T) { @@ -399,7 +398,7 @@ func Test_Glob(t *testing.T) { testpath() + "/testfiles/t2.txt", } - //===============================构建测试文件 + // ===============================构建测试文件 createDir(dirpath) for _, v := range havelist1 { createTestFile(dirpath+"/"+v, "") diff --git a/os/gfpool/gfpool.go b/os/gfpool/gfpool.go index 98bf0e224..5eec01b27 100644 --- a/os/gfpool/gfpool.go +++ b/os/gfpool/gfpool.go @@ -8,14 +8,15 @@ package gfpool import ( + "os" + "time" + "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/container/gpool" "github.com/gogf/gf/v2/container/gtype" - "os" - "time" ) -// File pointer pool. +// Pool pointer pool. type Pool struct { id *gtype.Int // Pool id, which is used to mark this pool whether recreated. pool *gpool.Pool // Underlying pool. diff --git a/os/gfpool/gfpool_file.go b/os/gfpool/gfpool_file.go index 3d318fd26..290615171 100644 --- a/os/gfpool/gfpool_file.go +++ b/os/gfpool/gfpool_file.go @@ -8,10 +8,11 @@ package gfpool import ( "fmt" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" "os" "time" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" ) // Open creates and returns a file item with given file path, flag and opening permission. @@ -25,10 +26,10 @@ func Open(path string, flag int, perm os.FileMode, ttl ...time.Duration) (file * // DO NOT search the path here wasting performance! // Leave following codes just for warning you. // - //path, err = gfile.Search(path) - //if err != nil { + // path, err = gfile.Search(path) + // if err != nil { // return nil, err - //} + // } pool := pools.GetOrSetFuncLock( fmt.Sprintf("%s&%d&%d&%d", path, flag, fpTTL, perm), func() interface{} { diff --git a/os/gfpool/gfpool_z_unit_concurrent_test.go b/os/gfpool/gfpool_z_unit_concurrent_test.go index 9c934b809..646293e09 100644 --- a/os/gfpool/gfpool_z_unit_concurrent_test.go +++ b/os/gfpool/gfpool_z_unit_concurrent_test.go @@ -7,13 +7,14 @@ package gfpool_test import ( + "os" + "testing" + "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/gfpool" "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" - "os" - "testing" ) func Test_ConcurrentOS(t *testing.T) { @@ -97,7 +98,7 @@ func Test_ConcurrentOS(t *testing.T) { t.Assert(gstr.Count(gfile.GetContents(path), "@1234567890#"), 2000) }) // DATA RACE - //gtest.C(t, func(t *gtest.T) { + // gtest.C(t, func(t *gtest.T) { // 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) @@ -131,7 +132,7 @@ func Test_ConcurrentOS(t *testing.T) { // close(ch) // wg.Wait() // t.Assert(gstr.Count(gfile.GetContents(path), "@1234567890#"), 2000) - //}) + // }) } func Test_ConcurrentGFPool(t *testing.T) { @@ -157,7 +158,7 @@ func Test_ConcurrentGFPool(t *testing.T) { t.Assert(gstr.Count(gfile.GetContents(path), "@1234567890#"), 2000) }) // DATA RACE - //gtest.C(t, func(t *gtest.T) { + // gtest.C(t, func(t *gtest.T) { // 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) @@ -191,5 +192,5 @@ func Test_ConcurrentGFPool(t *testing.T) { // close(ch) // wg.Wait() // t.Assert(gstr.Count(gfile.GetContents(path), "@1234567890#"), 2000) - //}) + // }) } diff --git a/os/gfsnotify/gfsnotify.go b/os/gfsnotify/gfsnotify.go index beadd0d52..12235ae61 100644 --- a/os/gfsnotify/gfsnotify.go +++ b/os/gfsnotify/gfsnotify.go @@ -9,10 +9,6 @@ package gfsnotify import ( "context" - "github.com/gogf/gf/v2/container/gset" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/internal/intlog" "sync" "time" @@ -20,7 +16,11 @@ import ( "github.com/gogf/gf/v2/container/glist" "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/container/gqueue" + "github.com/gogf/gf/v2/container/gset" "github.com/gogf/gf/v2/container/gtype" + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/internal/intlog" "github.com/gogf/gf/v2/os/gcache" ) diff --git a/os/gfsnotify/gfsnotify_watcher.go b/os/gfsnotify/gfsnotify_watcher.go index 92bf2cf00..87aee12b4 100644 --- a/os/gfsnotify/gfsnotify_watcher.go +++ b/os/gfsnotify/gfsnotify_watcher.go @@ -8,11 +8,11 @@ package gfsnotify import ( "context" + + "github.com/gogf/gf/v2/container/glist" "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/internal/intlog" - - "github.com/gogf/gf/v2/container/glist" ) // Add monitors `path` with callback function `callbackFunc` to the watcher. diff --git a/os/gfsnotify/gfsnotify_watcher_loop.go b/os/gfsnotify/gfsnotify_watcher_loop.go index bd41d3908..56c67e4be 100644 --- a/os/gfsnotify/gfsnotify_watcher_loop.go +++ b/os/gfsnotify/gfsnotify_watcher_loop.go @@ -8,6 +8,7 @@ package gfsnotify import ( "context" + "github.com/gogf/gf/v2/container/glist" "github.com/gogf/gf/v2/internal/intlog" ) diff --git a/os/gfsnotify/gfsnotify_z_unit_test.go b/os/gfsnotify/gfsnotify_z_unit_test.go index d8ec316c6..020e4fe09 100644 --- a/os/gfsnotify/gfsnotify_z_unit_test.go +++ b/os/gfsnotify/gfsnotify_z_unit_test.go @@ -7,10 +7,10 @@ package gfsnotify_test import ( - "github.com/gogf/gf/v2/container/garray" "testing" "time" + "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/container/gtype" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/gfsnotify" @@ -204,7 +204,7 @@ func TestWatcher_WatchFolderWithoutRecursively(t *testing.T) { t.AssertNil(err) _, err = gfsnotify.Add(dirPath, func(event *gfsnotify.Event) { - //fmt.Println(event.String()) + // fmt.Println(event.String()) array.Append(1) }, false) t.AssertNil(err) diff --git a/os/glog/glog_logger.go b/os/glog/glog_logger.go index bdd873976..178c5828b 100644 --- a/os/glog/glog_logger.go +++ b/os/glog/glog_logger.go @@ -10,25 +10,24 @@ import ( "bytes" "context" "fmt" - "github.com/fatih/color" - "github.com/gogf/gf/v2/container/gtype" - "github.com/gogf/gf/v2/internal/intlog" - "github.com/gogf/gf/v2/os/gctx" - "github.com/gogf/gf/v2/os/gfpool" - "github.com/gogf/gf/v2/os/gmlock" - "github.com/gogf/gf/v2/os/gtimer" - "go.opentelemetry.io/otel/trace" "io" "os" "strings" "time" + "github.com/fatih/color" + "github.com/gogf/gf/v2/container/gtype" "github.com/gogf/gf/v2/debug/gdebug" - + "github.com/gogf/gf/v2/internal/intlog" + "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/os/gfpool" + "github.com/gogf/gf/v2/os/gmlock" "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/os/gtimer" "github.com/gogf/gf/v2/text/gregex" "github.com/gogf/gf/v2/util/gconv" + "go.opentelemetry.io/otel/trace" ) // Logger is the struct for logging management. diff --git a/os/glog/glog_logger_config.go b/os/glog/glog_logger_config.go index c33ac786e..20c36e699 100644 --- a/os/glog/glog_logger_config.go +++ b/os/glog/glog_logger_config.go @@ -8,14 +8,14 @@ package glog import ( "context" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/os/gctx" "io" "strings" "time" + "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/internal/intlog" + "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/util/gconv" "github.com/gogf/gf/v2/util/gutil" @@ -255,7 +255,7 @@ func (l *Logger) SetHandlers(handlers ...Handler) { l.config.Handlers = handlers } -//SetWriterColorEnable sets the file logging with color +// SetWriterColorEnable sets the file logging with color func (l *Logger) SetWriterColorEnable(enabled bool) { l.config.WriterColorEnable = enabled } diff --git a/os/glog/glog_logger_level.go b/os/glog/glog_logger_level.go index 3f20e65d4..e1fe6b6a3 100644 --- a/os/glog/glog_logger_level.go +++ b/os/glog/glog_logger_level.go @@ -7,9 +7,10 @@ package glog import ( + "strings" + "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" - "strings" ) // Note that the LEVEL_PANI and LEVEL_FATA levels are not used for logging output, diff --git a/os/glog/glog_logger_rotate.go b/os/glog/glog_logger_rotate.go index 19470606b..6e7ca96de 100644 --- a/os/glog/glog_logger_rotate.go +++ b/os/glog/glog_logger_rotate.go @@ -9,6 +9,8 @@ package glog import ( "context" "fmt" + "time" + "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/encoding/gcompress" "github.com/gogf/gf/v2/internal/intlog" @@ -17,7 +19,6 @@ import ( "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/os/gtimer" "github.com/gogf/gf/v2/text/gregex" - "time" ) const ( diff --git a/os/glog/glog_z_example_test.go b/os/glog/glog_z_example_test.go index 3d8467b7d..e31c321c1 100644 --- a/os/glog/glog_z_example_test.go +++ b/os/glog/glog_z_example_test.go @@ -8,6 +8,7 @@ package glog_test import ( "context" + "github.com/gogf/gf/v2/frame/g" ) diff --git a/os/glog/glog_z_unit_basic_test.go b/os/glog/glog_z_unit_basic_test.go index 393953847..30ef4a4b7 100644 --- a/os/glog/glog_z_unit_basic_test.go +++ b/os/glog/glog_z_unit_basic_test.go @@ -9,9 +9,10 @@ package glog import ( "bytes" "context" + "testing" + "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" - "testing" ) var ( diff --git a/os/glog/glog_z_unit_chaining_test.go b/os/glog/glog_z_unit_chaining_test.go index 846ce62ca..f0f6989e5 100644 --- a/os/glog/glog_z_unit_chaining_test.go +++ b/os/glog/glog_z_unit_chaining_test.go @@ -9,12 +9,13 @@ package glog import ( "bytes" "fmt" + "testing" + "time" + "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" - "testing" - "time" ) func Test_To(t *testing.T) { diff --git a/os/glog/glog_z_unit_concurrent_test.go b/os/glog/glog_z_unit_concurrent_test.go index 43f036f68..a0d230dc1 100644 --- a/os/glog/glog_z_unit_concurrent_test.go +++ b/os/glog/glog_z_unit_concurrent_test.go @@ -7,13 +7,14 @@ package glog_test import ( + "sync" + "testing" + "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/glog" "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" - "sync" - "testing" ) func Test_Concurrent(t *testing.T) { diff --git a/os/glog/glog_z_unit_config_test.go b/os/glog/glog_z_unit_config_test.go index 43b2e1825..6b33466d9 100644 --- a/os/glog/glog_z_unit_config_test.go +++ b/os/glog/glog_z_unit_config_test.go @@ -8,9 +8,10 @@ package glog import ( "bytes" - "github.com/gogf/gf/v2/test/gtest" "strings" "testing" + + "github.com/gogf/gf/v2/test/gtest" ) func Test_SetConfigWithMap(t *testing.T) { diff --git a/os/glog/glog_z_unit_ctx_test.go b/os/glog/glog_z_unit_ctx_test.go index 028ed0a5b..a760cd331 100644 --- a/os/glog/glog_z_unit_ctx_test.go +++ b/os/glog/glog_z_unit_ctx_test.go @@ -9,12 +9,13 @@ package glog_test import ( "bytes" "context" + "testing" + "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/glog" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" - "testing" ) func Test_Ctx(t *testing.T) { diff --git a/os/glog/glog_z_unit_handler_test.go b/os/glog/glog_z_unit_handler_test.go index 587614f92..aeca8983e 100644 --- a/os/glog/glog_z_unit_handler_test.go +++ b/os/glog/glog_z_unit_handler_test.go @@ -9,11 +9,12 @@ package glog_test import ( "bytes" "context" + "testing" + "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/os/glog" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" - "testing" ) var arrayForHandlerTest1 = garray.NewStrArray() diff --git a/os/glog/glog_z_unit_level_test.go b/os/glog/glog_z_unit_level_test.go index cb49574a0..c5c9b68aa 100644 --- a/os/glog/glog_z_unit_level_test.go +++ b/os/glog/glog_z_unit_level_test.go @@ -8,9 +8,10 @@ package glog import ( "bytes" + "testing" + "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" - "testing" ) func Test_LevelPrefix(t *testing.T) { diff --git a/os/glog/glog_z_unit_rotate_test.go b/os/glog/glog_z_unit_rotate_test.go index 7ec5fe090..36da85b1d 100644 --- a/os/glog/glog_z_unit_rotate_test.go +++ b/os/glog/glog_z_unit_rotate_test.go @@ -9,14 +9,15 @@ package glog_test import ( "context" "fmt" + "testing" + "time" + "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/glog" "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" - "testing" - "time" ) var ( diff --git a/os/gmlock/gmlock_unit_rlock_test.go b/os/gmlock/gmlock_unit_rlock_test.go index 63d4bba2a..75cf0e5ba 100644 --- a/os/gmlock/gmlock_unit_rlock_test.go +++ b/os/gmlock/gmlock_unit_rlock_test.go @@ -16,7 +16,7 @@ import ( ) func Test_Locker_RLock(t *testing.T) { - //RLock before Lock + // RLock before Lock gtest.C(t, func(t *gtest.T) { key := "testRLockBeforeLock" array := garray.New(true) @@ -38,7 +38,7 @@ func Test_Locker_RLock(t *testing.T) { t.Assert(array.Len(), 2) }) - //Lock before RLock + // Lock before RLock gtest.C(t, func(t *gtest.T) { key := "testLockBeforeRLock" array := garray.New(true) @@ -60,7 +60,7 @@ func Test_Locker_RLock(t *testing.T) { t.Assert(array.Len(), 2) }) - //Lock before RLocks + // Lock before RLocks gtest.C(t, func(t *gtest.T) { key := "testLockBeforeRLocks" array := garray.New(true) @@ -92,7 +92,7 @@ func Test_Locker_RLock(t *testing.T) { } func Test_Locker_TryRLock(t *testing.T) { - //Lock before TryRLock + // Lock before TryRLock gtest.C(t, func(t *gtest.T) { key := "testLockBeforeTryRLock" array := garray.New(true) @@ -115,7 +115,7 @@ func Test_Locker_TryRLock(t *testing.T) { t.Assert(array.Len(), 1) }) - //Lock before TryRLocks + // Lock before TryRLocks gtest.C(t, func(t *gtest.T) { key := "testLockBeforeTryRLocks" array := garray.New(true) @@ -147,7 +147,7 @@ func Test_Locker_TryRLock(t *testing.T) { } func Test_Locker_RLockFunc(t *testing.T) { - //RLockFunc before Lock + // RLockFunc before Lock gtest.C(t, func(t *gtest.T) { key := "testRLockFuncBeforeLock" array := garray.New(true) @@ -169,7 +169,7 @@ func Test_Locker_RLockFunc(t *testing.T) { t.Assert(array.Len(), 2) }) - //Lock before RLockFunc + // Lock before RLockFunc gtest.C(t, func(t *gtest.T) { key := "testLockBeforeRLockFunc" array := garray.New(true) @@ -191,7 +191,7 @@ func Test_Locker_RLockFunc(t *testing.T) { t.Assert(array.Len(), 2) }) - //Lock before RLockFuncs + // Lock before RLockFuncs gtest.C(t, func(t *gtest.T) { key := "testLockBeforeRLockFuncs" array := garray.New(true) @@ -223,7 +223,7 @@ func Test_Locker_RLockFunc(t *testing.T) { } func Test_Locker_TryRLockFunc(t *testing.T) { - //Lock before TryRLockFunc + // Lock before TryRLockFunc gtest.C(t, func(t *gtest.T) { key := "testLockBeforeTryRLockFunc" array := garray.New(true) @@ -245,7 +245,7 @@ func Test_Locker_TryRLockFunc(t *testing.T) { t.Assert(array.Len(), 1) }) - //Lock before TryRLockFuncs + // Lock before TryRLockFuncs gtest.C(t, func(t *gtest.T) { key := "testLockBeforeTryRLockFuncs" array := garray.New(true) diff --git a/os/gmlock/gmlock_z_bench_test.go b/os/gmlock/gmlock_z_bench_test.go index 553500f56..b057ed933 100644 --- a/os/gmlock/gmlock_z_bench_test.go +++ b/os/gmlock/gmlock_z_bench_test.go @@ -7,8 +7,9 @@ package gmlock_test import ( - "github.com/gogf/gf/v2/os/gmlock" "testing" + + "github.com/gogf/gf/v2/os/gmlock" ) var ( diff --git a/os/gmutex/gmutex.go b/os/gmutex/gmutex.go index 1e9a35556..7de6dcdc6 100644 --- a/os/gmutex/gmutex.go +++ b/os/gmutex/gmutex.go @@ -14,7 +14,7 @@ import ( "github.com/gogf/gf/v2/container/gtype" ) -// The high level Mutex, which implements more rich features for mutex. +// Mutex The high level Mutex, which implements more rich features for mutex. type Mutex struct { state *gtype.Int32 // Indicates the state of mutex. -1: writing locked; > 1 reading locked. writer *gtype.Int32 // Pending writer count. diff --git a/os/gmutex/gmutex_unit_test.go b/os/gmutex/gmutex_unit_test.go index 24f8a5235..993dd04ff 100644 --- a/os/gmutex/gmutex_unit_test.go +++ b/os/gmutex/gmutex_unit_test.go @@ -8,11 +8,11 @@ package gmutex_test import ( "context" - "github.com/gogf/gf/v2/os/glog" "testing" "time" "github.com/gogf/gf/v2/container/garray" + "github.com/gogf/gf/v2/os/glog" "github.com/gogf/gf/v2/os/gmutex" "github.com/gogf/gf/v2/test/gtest" ) @@ -41,7 +41,7 @@ func Test_Mutex_RUnlock(t *testing.T) { }) - //RLock before Lock + // RLock before Lock gtest.C(t, func(t *gtest.T) { mu := gmutex.New() mu.RLock() diff --git a/os/gproc/gproc.go b/os/gproc/gproc.go index 7519a873a..328763dd6 100644 --- a/os/gproc/gproc.go +++ b/os/gproc/gproc.go @@ -9,14 +9,14 @@ package gproc import ( "bytes" - "github.com/gogf/gf/v2/os/genv" - "github.com/gogf/gf/v2/text/gstr" "io" "os" "runtime" "time" + "github.com/gogf/gf/v2/os/genv" "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" ) diff --git a/os/gproc/gproc_comm.go b/os/gproc/gproc_comm.go index 666fda1ac..a1ed5db1c 100644 --- a/os/gproc/gproc_comm.go +++ b/os/gproc/gproc_comm.go @@ -9,6 +9,7 @@ package gproc import ( "context" "fmt" + "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" diff --git a/os/gproc/gproc_comm_receive.go b/os/gproc/gproc_comm_receive.go index b4f991f84..c23d0dd30 100644 --- a/os/gproc/gproc_comm_receive.go +++ b/os/gproc/gproc_comm_receive.go @@ -9,11 +9,11 @@ package gproc import ( "context" "fmt" - "github.com/gogf/gf/v2/internal/json" "net" "github.com/gogf/gf/v2/container/gqueue" "github.com/gogf/gf/v2/container/gtype" + "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/net/gtcp" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/glog" @@ -94,7 +94,7 @@ func receiveTcpHandler(conn *gtcp.Conn) { // Package decoding. msg := new(MsgRequest) if err := json.UnmarshalUseNumber(buffer, msg); err != nil { - //glog.Error(err) + // glog.Error(err) continue } if msg.RecvPid != Pid() { diff --git a/os/gproc/gproc_comm_send.go b/os/gproc/gproc_comm_send.go index a19b6377d..fee372d38 100644 --- a/os/gproc/gproc_comm_send.go +++ b/os/gproc/gproc_comm_send.go @@ -7,10 +7,11 @@ package gproc import ( + "io" + "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/net/gtcp" - "io" ) // Send sends data to specified process of given pid. diff --git a/os/gproc/gproc_process.go b/os/gproc/gproc_process.go index 355bf7f36..d420cece7 100644 --- a/os/gproc/gproc_process.go +++ b/os/gproc/gproc_process.go @@ -9,13 +9,14 @@ package gproc import ( "context" "fmt" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/internal/intlog" "os" "os/exec" "runtime" "strings" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/internal/intlog" ) // Process is the struct for a single process. @@ -123,7 +124,7 @@ func (p *Process) Kill() error { } _, err = p.Process.Wait() intlog.Error(context.TODO(), err) - //return err + // return err return nil } else { return err diff --git a/os/gproc/gproc_signal.go b/os/gproc/gproc_signal.go index a84805952..4454d8745 100644 --- a/os/gproc/gproc_signal.go +++ b/os/gproc/gproc_signal.go @@ -8,11 +8,12 @@ package gproc import ( "context" - "github.com/gogf/gf/v2/internal/intlog" "os" "os/signal" "sync" "syscall" + + "github.com/gogf/gf/v2/internal/intlog" ) // SigHandler defines a function type for signal handling. diff --git a/os/gres/gres_file.go b/os/gres/gres_file.go index ca46f0c19..c138d6455 100644 --- a/os/gres/gres_file.go +++ b/os/gres/gres_file.go @@ -9,9 +9,10 @@ package gres import ( "archive/zip" "bytes" - "github.com/gogf/gf/v2/internal/json" "io" "os" + + "github.com/gogf/gf/v2/internal/json" ) type File struct { diff --git a/os/gres/gres_func.go b/os/gres/gres_func.go index 56e75b74d..36a6b8455 100644 --- a/os/gres/gres_func.go +++ b/os/gres/gres_func.go @@ -11,6 +11,7 @@ import ( "bytes" "encoding/hex" "fmt" + "github.com/gogf/gf/v2/encoding/gbase64" "github.com/gogf/gf/v2/encoding/gcompress" "github.com/gogf/gf/v2/os/gfile" diff --git a/os/gres/gres_func_zip.go b/os/gres/gres_func_zip.go index a8011fb2a..18e8cf7ac 100644 --- a/os/gres/gres_func_zip.go +++ b/os/gres/gres_func_zip.go @@ -9,14 +9,15 @@ package gres import ( "archive/zip" "context" - "github.com/gogf/gf/v2/internal/fileinfo" - "github.com/gogf/gf/v2/internal/intlog" - "github.com/gogf/gf/v2/os/gfile" - "github.com/gogf/gf/v2/text/gregex" "io" "os" "strings" "time" + + "github.com/gogf/gf/v2/internal/fileinfo" + "github.com/gogf/gf/v2/internal/intlog" + "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/text/gregex" ) // ZipPathWriter compresses `paths` to `writer` using zip compressing algorithm. diff --git a/os/gres/gres_http_file.go b/os/gres/gres_http_file.go index 62c5f56db..9a06c1cbd 100644 --- a/os/gres/gres_http_file.go +++ b/os/gres/gres_http_file.go @@ -11,7 +11,7 @@ import ( "os" ) -// Close implements Close interface of http.File. +// Close implements interface of http.File. func (f *File) Close() error { return nil } diff --git a/os/gres/gres_instance.go b/os/gres/gres_instance.go index 8becdaae3..f9e3fff3f 100644 --- a/os/gres/gres_instance.go +++ b/os/gres/gres_instance.go @@ -9,7 +9,7 @@ package gres import "github.com/gogf/gf/v2/container/gmap" const ( - // Default group name for instance usage. + // DefaultName Default group name for instance usage. DefaultName = "default" ) diff --git a/os/gres/gres_resource.go b/os/gres/gres_resource.go index 7a6c35908..9c8547264 100644 --- a/os/gres/gres_resource.go +++ b/os/gres/gres_resource.go @@ -9,15 +9,14 @@ package gres import ( "context" "fmt" - "github.com/gogf/gf/v2/internal/intlog" "os" "path/filepath" "strings" - "github.com/gogf/gf/v2/os/gtime" - "github.com/gogf/gf/v2/container/gtree" + "github.com/gogf/gf/v2/internal/intlog" "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/os/gtime" ) type Resource struct { diff --git a/os/gres/gres_z_unit_1_test.go b/os/gres/gres_z_unit_1_test.go index abd994a86..a0cdaeca4 100644 --- a/os/gres/gres_z_unit_1_test.go +++ b/os/gres/gres_z_unit_1_test.go @@ -7,14 +7,13 @@ package gres_test import ( - "github.com/gogf/gf/v2/os/gtime" "strings" "testing" - "github.com/gogf/gf/v2/os/gfile" - "github.com/gogf/gf/v2/debug/gdebug" + "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/gres" + "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" ) diff --git a/os/gres/gres_z_unit_2_test.go b/os/gres/gres_z_unit_2_test.go index dd13a2120..c95fe7f9c 100644 --- a/os/gres/gres_z_unit_2_test.go +++ b/os/gres/gres_z_unit_2_test.go @@ -7,14 +7,12 @@ package gres_test import ( - _ "github.com/gogf/gf/v2/os/gres/testdata/data" - "testing" "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/test/gtest" - "github.com/gogf/gf/v2/os/gres" + _ "github.com/gogf/gf/v2/os/gres/testdata/data" + "github.com/gogf/gf/v2/test/gtest" ) func Test_Basic(t *testing.T) { diff --git a/os/grpool/grpool.go b/os/grpool/grpool.go index d463dd0ec..6aa97af04 100644 --- a/os/grpool/grpool.go +++ b/os/grpool/grpool.go @@ -9,11 +9,11 @@ package grpool import ( "context" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/container/glist" "github.com/gogf/gf/v2/container/gtype" + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" ) // Func is the pool function which contains context parameter. diff --git a/os/gsession/gsession_manager.go b/os/gsession/gsession_manager.go index 31116d785..192cb09a7 100644 --- a/os/gsession/gsession_manager.go +++ b/os/gsession/gsession_manager.go @@ -8,10 +8,10 @@ package gsession import ( "context" - "github.com/gogf/gf/v2/container/gmap" - "github.com/gogf/gf/v2/internal/intlog" "time" + "github.com/gogf/gf/v2/container/gmap" + "github.com/gogf/gf/v2/internal/intlog" "github.com/gogf/gf/v2/os/gcache" ) diff --git a/os/gsession/gsession_session.go b/os/gsession/gsession_session.go index be9ee9436..5db11ac7b 100644 --- a/os/gsession/gsession_session.go +++ b/os/gsession/gsession_session.go @@ -8,13 +8,13 @@ package gsession import ( "context" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/internal/intlog" "time" "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/container/gvar" + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/internal/intlog" ) // Session struct for storing single session data, which is bound to a single request. diff --git a/os/gsession/gsession_storage.go b/os/gsession/gsession_storage.go index 9e787c345..47459da35 100644 --- a/os/gsession/gsession_storage.go +++ b/os/gsession/gsession_storage.go @@ -8,8 +8,9 @@ package gsession import ( "context" - "github.com/gogf/gf/v2/container/gmap" "time" + + "github.com/gogf/gf/v2/container/gmap" ) // Storage is the interface definition for session storage. diff --git a/os/gsession/gsession_storage_file.go b/os/gsession/gsession_storage_file.go index 419af6724..c8a4d2877 100644 --- a/os/gsession/gsession_storage_file.go +++ b/os/gsession/gsession_storage_file.go @@ -8,24 +8,20 @@ package gsession import ( "context" + "os" + "time" + "github.com/gogf/gf/v2/container/gmap" + "github.com/gogf/gf/v2/container/gset" + "github.com/gogf/gf/v2/crypto/gaes" + "github.com/gogf/gf/v2/encoding/gbinary" "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/internal/intlog" "github.com/gogf/gf/v2/internal/json" - "os" - "time" - - "github.com/gogf/gf/v2/crypto/gaes" - - "github.com/gogf/gf/v2/os/gtimer" - - "github.com/gogf/gf/v2/container/gset" - "github.com/gogf/gf/v2/encoding/gbinary" - - "github.com/gogf/gf/v2/os/gtime" - "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/os/gtime" + "github.com/gogf/gf/v2/os/gtimer" ) // StorageFile implements the Session Storage interface with file system. diff --git a/os/gsession/gsession_storage_memory.go b/os/gsession/gsession_storage_memory.go index b6db3f387..f34a50476 100644 --- a/os/gsession/gsession_storage_memory.go +++ b/os/gsession/gsession_storage_memory.go @@ -8,8 +8,9 @@ package gsession import ( "context" - "github.com/gogf/gf/v2/container/gmap" "time" + + "github.com/gogf/gf/v2/container/gmap" ) // StorageMemory implements the Session Storage interface with memory. diff --git a/os/gsession/gsession_storage_redis.go b/os/gsession/gsession_storage_redis.go index c7c64bd02..642b0d525 100644 --- a/os/gsession/gsession_storage_redis.go +++ b/os/gsession/gsession_storage_redis.go @@ -8,12 +8,12 @@ package gsession import ( "context" + "time" + "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/database/gredis" "github.com/gogf/gf/v2/internal/intlog" "github.com/gogf/gf/v2/internal/json" - "time" - "github.com/gogf/gf/v2/os/gtimer" ) diff --git a/os/gsession/gsession_unit_storage_file_test.go b/os/gsession/gsession_unit_storage_file_test.go index 5b2385215..3f2b75db0 100644 --- a/os/gsession/gsession_unit_storage_file_test.go +++ b/os/gsession/gsession_unit_storage_file_test.go @@ -8,11 +8,11 @@ package gsession_test import ( "context" - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gsession" "testing" "time" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gsession" "github.com/gogf/gf/v2/test/gtest" ) diff --git a/os/gsession/gsession_unit_storage_memory_test.go b/os/gsession/gsession_unit_storage_memory_test.go index 237981486..02d55830e 100644 --- a/os/gsession/gsession_unit_storage_memory_test.go +++ b/os/gsession/gsession_unit_storage_memory_test.go @@ -8,11 +8,11 @@ package gsession_test import ( "context" - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gsession" "testing" "time" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gsession" "github.com/gogf/gf/v2/test/gtest" ) diff --git a/os/gsession/gsession_unit_storage_redis_hashtable_test.go b/os/gsession/gsession_unit_storage_redis_hashtable_test.go index 7c243e779..22b5bdc44 100644 --- a/os/gsession/gsession_unit_storage_redis_hashtable_test.go +++ b/os/gsession/gsession_unit_storage_redis_hashtable_test.go @@ -8,12 +8,12 @@ package gsession_test import ( "context" - "github.com/gogf/gf/v2/database/gredis" - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gsession" "testing" "time" + "github.com/gogf/gf/v2/database/gredis" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gsession" "github.com/gogf/gf/v2/test/gtest" ) diff --git a/os/gsession/gsession_unit_storage_redis_test.go b/os/gsession/gsession_unit_storage_redis_test.go index b6e3bb631..13461c55f 100644 --- a/os/gsession/gsession_unit_storage_redis_test.go +++ b/os/gsession/gsession_unit_storage_redis_test.go @@ -8,12 +8,12 @@ package gsession_test import ( "context" - "github.com/gogf/gf/v2/database/gredis" - "github.com/gogf/gf/v2/frame/g" - "github.com/gogf/gf/v2/os/gsession" "testing" "time" + "github.com/gogf/gf/v2/database/gredis" + "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gsession" "github.com/gogf/gf/v2/test/gtest" ) diff --git a/os/gspath/gspath.go b/os/gspath/gspath.go index b062ead2f..e0a986cfc 100644 --- a/os/gspath/gspath.go +++ b/os/gspath/gspath.go @@ -13,15 +13,15 @@ package gspath import ( "context" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/internal/intlog" "os" "sort" "strings" "github.com/gogf/gf/v2/container/garray" "github.com/gogf/gf/v2/container/gmap" + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/internal/intlog" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/text/gstr" ) @@ -53,7 +53,7 @@ func New(path string, cache bool) *SPath { } if len(path) > 0 { if _, err := sp.Add(path); err != nil { - //intlog.Print(err) + // intlog.Print(err) } } return sp @@ -143,7 +143,7 @@ func (sp *SPath) Add(path string) (realPath string, err error) { } // The added path must be a directory. if gfile.IsDir(realPath) { - //fmt.Println("gspath:", realPath, sp.paths.Search(realPath)) + // fmt.Println("gspath:", realPath, sp.paths.Search(realPath)) // It will not add twice for the same directory. if sp.paths.Search(realPath) < 0 { realPath = strings.TrimRight(realPath, gfile.Separator) diff --git a/os/gtime/gtime.go b/os/gtime/gtime.go index 92240fbbc..d4d5a9877 100644 --- a/os/gtime/gtime.go +++ b/os/gtime/gtime.go @@ -11,15 +11,15 @@ package gtime import ( "fmt" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" - "github.com/gogf/gf/v2/internal/utils" "os" "regexp" "strconv" "strings" "time" + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" + "github.com/gogf/gf/v2/internal/utils" "github.com/gogf/gf/v2/text/gregex" ) @@ -231,19 +231,19 @@ func StrToTime(str string, format ...string) (*Time, error) { local = time.Local ) if match = timeRegex1.FindStringSubmatch(str); len(match) > 0 && match[1] != "" { - //for k, v := range match { + // for k, v := range match { // match[k] = strings.TrimSpace(v) - //} + // } year, month, day = parseDateStr(match[1]) } else if match = timeRegex2.FindStringSubmatch(str); len(match) > 0 && match[1] != "" { - //for k, v := range match { + // for k, v := range match { // match[k] = strings.TrimSpace(v) - //} + // } year, month, day = parseDateStr(match[1]) } else if match = timeRegex3.FindStringSubmatch(str); len(match) > 0 && match[1] != "" { - //for k, v := range match { + // for k, v := range match { // match[k] = strings.TrimSpace(v) - //} + // } s := strings.Replace(match[2], ":", "", -1) if len(s) < 6 { s += strings.Repeat("0", 6-len(s)) diff --git a/os/gtime/gtime_time.go b/os/gtime/gtime_time.go index 4c92dad3e..7e28fe324 100644 --- a/os/gtime/gtime_time.go +++ b/os/gtime/gtime_time.go @@ -8,10 +8,11 @@ package gtime import ( "bytes" - "github.com/gogf/gf/v2/errors/gcode" - "github.com/gogf/gf/v2/errors/gerror" "strconv" "time" + + "github.com/gogf/gf/v2/errors/gcode" + "github.com/gogf/gf/v2/errors/gerror" ) // Time is a wrapper for time.Time for additional features. diff --git a/os/gtime/gtime_z_unit_basic_test.go b/os/gtime/gtime_z_unit_basic_test.go index f3ca948d6..a65635507 100644 --- a/os/gtime/gtime_z_unit_basic_test.go +++ b/os/gtime/gtime_z_unit_basic_test.go @@ -7,10 +7,10 @@ package gtime_test import ( - "github.com/gogf/gf/v2/frame/g" "testing" "time" + "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" ) @@ -18,7 +18,7 @@ import ( func Test_SetTimeZone(t *testing.T) { gtest.C(t, func(t *gtest.T) { t.Assert(gtime.SetTimeZone("Asia/Shanghai"), nil) - //t.Assert(time.Local.String(), "Asia/Shanghai") + // t.Assert(time.Local.String(), "Asia/Shanghai") }) } @@ -174,7 +174,7 @@ func Test_StrToTime(t *testing.T) { } } - //test err + // test err _, err := gtime.StrToTime("2006-01-02 15:04:05", "aabbccdd") if err == nil { t.Error("test fail") @@ -184,44 +184,44 @@ func Test_StrToTime(t *testing.T) { func Test_ConvertZone(t *testing.T) { gtest.C(t, func(t *gtest.T) { - //现行时间 + // 现行时间 nowUTC := time.Now().UTC() testZone := "America/Los_Angeles" - //转换为洛杉矶时间 + // 转换为洛杉矶时间 t1, err := gtime.ConvertZone(nowUTC.Format("2006-01-02 15:04:05"), testZone, "") if err != nil { t.Error("test fail") } - //使用洛杉矶时区解析上面转换后的时间 + // 使用洛杉矶时区解析上面转换后的时间 laStr := t1.Time.Format("2006-01-02 15:04:05") loc, err := time.LoadLocation(testZone) t2, err := time.ParseInLocation("2006-01-02 15:04:05", laStr, loc) - //判断是否与现行时间匹配 + // 判断是否与现行时间匹配 t.Assert(t2.UTC().Unix(), nowUTC.Unix()) }) - //test err + // test err gtest.C(t, func(t *gtest.T) { - //现行时间 + // 现行时间 nowUTC := time.Now().UTC() - //t.Log(nowUTC.Unix()) + // t.Log(nowUTC.Unix()) testZone := "errZone" - //错误时间输入 + // 错误时间输入 _, err := gtime.ConvertZone(nowUTC.Format("06..02 15:04:05"), testZone, "") if err == nil { t.Error("test fail") } - //错误时区输入 + // 错误时区输入 _, err = gtime.ConvertZone(nowUTC.Format("2006-01-02 15:04:05"), testZone, "") if err == nil { t.Error("test fail") } - //错误时区输入 + // 错误时区输入 _, err = gtime.ConvertZone(nowUTC.Format("2006-01-02 15:04:05"), testZone, testZone) if err == nil { t.Error("test fail") @@ -269,7 +269,7 @@ func Test_ParseTimeFromContent(t *testing.T) { timeTemp2 := gtime.ParseTimeFromContent("我是中文02.jan.2006 15:04:05我也是中文") t.Assert(timeTemp2.Time.Format("2006-01-02 15:04:05"), "2006-01-02 15:04:05") - //test err + // test err timeTempErr := gtime.ParseTimeFromContent("我是中文", "Y-m-d H:i:s") if timeTempErr != nil { t.Error("test fail") diff --git a/os/gtime/gtime_z_unit_json_test.go b/os/gtime/gtime_z_unit_json_test.go index 490a4e54e..1704ff926 100644 --- a/os/gtime/gtime_z_unit_json_test.go +++ b/os/gtime/gtime_z_unit_json_test.go @@ -7,10 +7,11 @@ package gtime_test import ( + "testing" + "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" - "testing" ) func Test_Json_Pointer(t *testing.T) { diff --git a/os/gtime/gtime_z_unit_sql_test.go b/os/gtime/gtime_z_unit_sql_test.go index 332dd1fdc..b4133daad 100644 --- a/os/gtime/gtime_z_unit_sql_test.go +++ b/os/gtime/gtime_z_unit_sql_test.go @@ -1,23 +1,24 @@ package gtime_test import ( + "testing" + "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/test/gtest" - "testing" ) func TestTime_Scan(t1 *testing.T) { gtest.C(t1, func(t *gtest.T) { tt := gtime.Time{} - //test string + // test string s := gtime.Now().String() t.Assert(tt.Scan(s), nil) t.Assert(tt.String(), s) - //test nano + // test nano n := gtime.TimestampNano() t.Assert(tt.Scan(n), nil) t.Assert(tt.TimestampNano(), n) - //test nil + // test nil none := (*gtime.Time)(nil) t.Assert(none.Scan(nil), nil) t.Assert(none, nil) @@ -31,7 +32,7 @@ func TestTime_Value(t1 *testing.T) { s, err := tt.Value() t.Assert(err, nil) t.Assert(s, tt.Time) - //test nil + // test nil none := (*gtime.Time)(nil) s, err = none.Value() t.Assert(err, nil) diff --git a/os/gtimer/gtimer.go b/os/gtimer/gtimer.go index 6d543c90a..f2af5133a 100644 --- a/os/gtimer/gtimer.go +++ b/os/gtimer/gtimer.go @@ -20,10 +20,10 @@ package gtimer import ( "context" - "github.com/gogf/gf/v2/container/gtype" "sync" "time" + "github.com/gogf/gf/v2/container/gtype" "github.com/gogf/gf/v2/os/gcmd" ) diff --git a/os/gtimer/gtimer_entry.go b/os/gtimer/gtimer_entry.go index 9f645a4d9..98f85f6d0 100644 --- a/os/gtimer/gtimer_entry.go +++ b/os/gtimer/gtimer_entry.go @@ -8,6 +8,7 @@ package gtimer import ( "context" + "github.com/gogf/gf/v2/container/gtype" ) diff --git a/os/gtimer/gtimer_queue.go b/os/gtimer/gtimer_queue.go index 1a1577da8..08fdd46f3 100644 --- a/os/gtimer/gtimer_queue.go +++ b/os/gtimer/gtimer_queue.go @@ -8,9 +8,10 @@ package gtimer import ( "container/heap" - "github.com/gogf/gf/v2/container/gtype" "math" "sync" + + "github.com/gogf/gf/v2/container/gtype" ) // priorityQueue is an abstract data type similar to a regular queue or stack data structure in which diff --git a/os/gtimer/gtimer_timer.go b/os/gtimer/gtimer_timer.go index 385883f65..88859f935 100644 --- a/os/gtimer/gtimer_timer.go +++ b/os/gtimer/gtimer_timer.go @@ -8,8 +8,9 @@ package gtimer import ( "context" - "github.com/gogf/gf/v2/container/gtype" "time" + + "github.com/gogf/gf/v2/container/gtype" ) func New(options ...TimerOptions) *Timer { diff --git a/os/gtimer/gtimer_z_unit_timer_internal_test.go b/os/gtimer/gtimer_z_unit_timer_internal_test.go index 5748cf908..fda89b155 100644 --- a/os/gtimer/gtimer_z_unit_timer_internal_test.go +++ b/os/gtimer/gtimer_z_unit_timer_internal_test.go @@ -8,10 +8,11 @@ package gtimer import ( "context" - "github.com/gogf/gf/v2/container/garray" - "github.com/gogf/gf/v2/test/gtest" "testing" "time" + + "github.com/gogf/gf/v2/container/garray" + "github.com/gogf/gf/v2/test/gtest" ) func TestTimer_Proceed(t *testing.T) { diff --git a/os/gview/gview.go b/os/gview/gview.go index 3d9848d74..47a0f8a8c 100644 --- a/os/gview/gview.go +++ b/os/gview/gview.go @@ -12,11 +12,11 @@ package gview import ( "context" - "github.com/gogf/gf/v2/container/gmap" - "github.com/gogf/gf/v2/internal/intlog" "github.com/gogf/gf/v2" "github.com/gogf/gf/v2/container/garray" + "github.com/gogf/gf/v2/container/gmap" + "github.com/gogf/gf/v2/internal/intlog" "github.com/gogf/gf/v2/os/gcmd" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/glog" diff --git a/os/gview/gview_buildin.go b/os/gview/gview_buildin.go index 3da297f9a..2728b76ed 100644 --- a/os/gview/gview_buildin.go +++ b/os/gview/gview_buildin.go @@ -9,17 +9,16 @@ package gview import ( "context" "fmt" - "github.com/gogf/gf/v2/internal/json" - "github.com/gogf/gf/v2/util/gutil" + htmltpl "html/template" "strings" "github.com/gogf/gf/v2/encoding/ghtml" "github.com/gogf/gf/v2/encoding/gurl" + "github.com/gogf/gf/v2/internal/json" "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gconv" - - htmltpl "html/template" + "github.com/gogf/gf/v2/util/gutil" ) // buildInFuncDump implements build-in template function: dump diff --git a/os/gview/gview_config.go b/os/gview/gview_config.go index 25cc2aa77..d00beb5c7 100644 --- a/os/gview/gview_config.go +++ b/os/gview/gview_config.go @@ -8,6 +8,7 @@ package gview import ( "context" + "github.com/gogf/gf/v2/errors/gcode" "github.com/gogf/gf/v2/errors/gerror" "github.com/gogf/gf/v2/i18n/gi18n" @@ -146,7 +147,7 @@ func (view *View) SetPath(path string) error { view.paths.Clear() view.paths.Append(realPath) view.fileCacheMap.Clear() - //glog.Debug("[gview] SetPath:", realPath) + // glog.Debug("[gview] SetPath:", realPath) return nil } diff --git a/os/gview/gview_i18n.go b/os/gview/gview_i18n.go index d406ed118..7b3f93cf7 100644 --- a/os/gview/gview_i18n.go +++ b/os/gview/gview_i18n.go @@ -8,6 +8,7 @@ package gview import ( "context" + "github.com/gogf/gf/v2/i18n/gi18n" "github.com/gogf/gf/v2/util/gconv" ) diff --git a/os/gview/gview_instance.go b/os/gview/gview_instance.go index 5f61fdc34..9670b4a56 100644 --- a/os/gview/gview_instance.go +++ b/os/gview/gview_instance.go @@ -9,7 +9,7 @@ package gview import "github.com/gogf/gf/v2/container/gmap" const ( - // Default group name for instance usage. + // DefaultName Default group name for instance usage. DefaultName = "default" ) diff --git a/os/gview/gview_parse.go b/os/gview/gview_parse.go index f060f951f..3fadb3d24 100644 --- a/os/gview/gview_parse.go +++ b/os/gview/gview_parse.go @@ -10,6 +10,11 @@ import ( "bytes" "context" "fmt" + htmltpl "html/template" + "strconv" + "strings" + texttpl "text/template" + "github.com/gogf/gf/v2/container/gmap" "github.com/gogf/gf/v2/encoding/ghash" "github.com/gogf/gf/v2/errors/gcode" @@ -23,10 +28,6 @@ import ( "github.com/gogf/gf/v2/os/gspath" "github.com/gogf/gf/v2/text/gstr" "github.com/gogf/gf/v2/util/gutil" - htmltpl "html/template" - "strconv" - "strings" - texttpl "text/template" ) const ( diff --git a/os/gview/gview_unit_basic_test.go b/os/gview/gview_unit_basic_test.go index 8f5cac4f6..6311f7ad7 100644 --- a/os/gview/gview_unit_basic_test.go +++ b/os/gview/gview_unit_basic_test.go @@ -8,21 +8,21 @@ package gview_test import ( "context" - "github.com/gogf/gf/v2/encoding/ghtml" - "github.com/gogf/gf/v2/os/gctx" - "github.com/gogf/gf/v2/os/gtime" - "github.com/gogf/gf/v2/util/gconv" "io/ioutil" "os" "strings" "testing" "time" + "github.com/gogf/gf/v2/encoding/ghtml" "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gctx" "github.com/gogf/gf/v2/os/gfile" + "github.com/gogf/gf/v2/os/gtime" "github.com/gogf/gf/v2/os/gview" "github.com/gogf/gf/v2/test/gtest" "github.com/gogf/gf/v2/text/gstr" + "github.com/gogf/gf/v2/util/gconv" ) func init() { @@ -45,13 +45,13 @@ func Test_Basic(t *testing.T) { t.Assert(err != nil, false) t.Assert(result, "hello gf,version:1.7.0;hello gf,version:1.7.0;that's all") - //测试api方法 + // 测试api方法 str = `hello {{.name}}` result, err = gview.ParseContent(context.TODO(), str, g.Map{"name": "gf"}) t.Assert(err != nil, false) t.Assert(result, "hello gf") - //测试instance方法 + // 测试instance方法 result, err = gview.Instance().ParseContent(context.TODO(), str, g.Map{"name": "gf"}) t.Assert(err != nil, false) t.Assert(result, "hello gf") @@ -224,7 +224,7 @@ func Test_FuncInclude(t *testing.T) { templatePath := gfile.Pwd() + gfile.Separator + "template" gfile.Mkdir(templatePath) defer gfile.Remove(templatePath) - //headerFile, _ := gfile.Create(templatePath + gfile.Separator + "header.html") + // headerFile, _ := gfile.Create(templatePath + gfile.Separator + "header.html") err := ioutil.WriteFile(templatePath+gfile.Separator+"header.html", []byte(header), 0644) if err != nil { t.Error(err) diff --git a/os/gview/gview_unit_config_test.go b/os/gview/gview_unit_config_test.go index 0da2cfa82..ea70d0a08 100644 --- a/os/gview/gview_unit_config_test.go +++ b/os/gview/gview_unit_config_test.go @@ -8,11 +8,12 @@ package gview_test import ( "context" + "testing" + "github.com/gogf/gf/v2/debug/gdebug" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gview" "github.com/gogf/gf/v2/test/gtest" - "testing" ) func Test_Config(t *testing.T) { diff --git a/os/gview/gview_unit_encode_test.go b/os/gview/gview_unit_encode_test.go index 6e20b9af2..dc7913de5 100644 --- a/os/gview/gview_unit_encode_test.go +++ b/os/gview/gview_unit_encode_test.go @@ -8,12 +8,13 @@ package gview_test import ( "context" + "testing" + "github.com/gogf/gf/v2/debug/gdebug" "github.com/gogf/gf/v2/frame/g" "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/os/gview" "github.com/gogf/gf/v2/test/gtest" - "testing" ) func Test_Encode_Parse(t *testing.T) { diff --git a/os/gview/gview_unit_i18n_test.go b/os/gview/gview_unit_i18n_test.go index 35fe0431c..58c1c27d5 100644 --- a/os/gview/gview_unit_i18n_test.go +++ b/os/gview/gview_unit_i18n_test.go @@ -11,9 +11,8 @@ import ( "testing" "github.com/gogf/gf/v2/debug/gdebug" - "github.com/gogf/gf/v2/os/gfile" - "github.com/gogf/gf/v2/frame/g" + "github.com/gogf/gf/v2/os/gfile" "github.com/gogf/gf/v2/test/gtest" )