diff --git a/container/garray/garray.go b/container/garray/garray.go index d1ca55d5e..8cc88e71b 100644 --- a/container/garray/garray.go +++ b/container/garray/garray.go @@ -4,5 +4,5 @@ // If a copy of the MIT was not distributed with this file, // You can obtain one at https://github.com/gogf/gf. -// Package garray provides concurrent-safe/unsafe arrays. +// Package garray provides most commonly used array containers which also support concurrent-safe/unsafe switch feature. package garray diff --git a/container/garray/garray_normal_any.go b/container/garray/garray_normal_any.go index 292c14db1..559350235 100644 --- a/container/garray/garray_normal_any.go +++ b/container/garray/garray_normal_any.go @@ -22,6 +22,8 @@ import ( ) // Array is a golang array with rich features. +// It contains a concurrent-safe/unsafe switch, which should be set +// when its initialization and cannot be changed then. type Array struct { mu rwmutex.RWMutex array []interface{} diff --git a/container/garray/garray_normal_int.go b/container/garray/garray_normal_int.go index 94176aba4..52df40bdf 100644 --- a/container/garray/garray_normal_int.go +++ b/container/garray/garray_normal_int.go @@ -20,6 +20,8 @@ import ( ) // IntArray is a golang int array with rich features. +// It contains a concurrent-safe/unsafe switch, which should be set +// when its initialization and cannot be changed then. type IntArray struct { mu rwmutex.RWMutex array []int diff --git a/container/garray/garray_normal_str.go b/container/garray/garray_normal_str.go index 3f53358a3..fc562ed3f 100644 --- a/container/garray/garray_normal_str.go +++ b/container/garray/garray_normal_str.go @@ -22,6 +22,8 @@ import ( ) // StrArray is a golang string array with rich features. +// It contains a concurrent-safe/unsafe switch, which should be set +// when its initialization and cannot be changed then. type StrArray struct { mu rwmutex.RWMutex array []string diff --git a/container/garray/garray_sorted_any.go b/container/garray/garray_sorted_any.go index ac7f6a6a2..0a1aeec3c 100644 --- a/container/garray/garray_sorted_any.go +++ b/container/garray/garray_sorted_any.go @@ -22,7 +22,10 @@ import ( ) // SortedArray is a golang sorted array with rich features. -// It's using increasing order in default. +// It is using increasing order in default, which can be changed by +// setting it a custom comparator. +// It contains a concurrent-safe/unsafe switch, which should be set +// when its initialization and cannot be changed then. type SortedArray struct { mu rwmutex.RWMutex array []interface{} diff --git a/container/garray/garray_sorted_int.go b/container/garray/garray_sorted_int.go index 45a09ca6f..e75bd5cf0 100644 --- a/container/garray/garray_sorted_int.go +++ b/container/garray/garray_sorted_int.go @@ -19,7 +19,10 @@ import ( ) // SortedIntArray is a golang sorted int array with rich features. -// It's using increasing order in default. +// It is using increasing order in default, which can be changed by +// setting it a custom comparator. +// It contains a concurrent-safe/unsafe switch, which should be set +// when its initialization and cannot be changed then. type SortedIntArray struct { mu rwmutex.RWMutex array []int diff --git a/container/garray/garray_sorted_str.go b/container/garray/garray_sorted_str.go index 65d880ec3..933def543 100644 --- a/container/garray/garray_sorted_str.go +++ b/container/garray/garray_sorted_str.go @@ -20,7 +20,10 @@ import ( ) // SortedStrArray is a golang sorted string array with rich features. -// It's using increasing order in default. +// It is using increasing order in default, which can be changed by +// setting it a custom comparator. +// It contains a concurrent-safe/unsafe switch, which should be set +// when its initialization and cannot be changed then. type SortedStrArray struct { mu rwmutex.RWMutex array []string diff --git a/container/glist/glist.go b/container/glist/glist.go index 6bdd3af9d..30f53581e 100644 --- a/container/glist/glist.go +++ b/container/glist/glist.go @@ -5,7 +5,7 @@ // You can obtain one at https://github.com/gogf/gf. // -// Package glist provides a concurrent-safe/unsafe doubly linked list. +// Package glist provides most commonly used doubly linked list container which also supports concurrent-safe/unsafe switch feature. package glist import ( @@ -19,11 +19,13 @@ import ( ) type ( + // List is a doubly linked list containing a concurrent-safe/unsafe switch. + // The switch should be set when its initialization and cannot be changed then. List struct { mu rwmutex.RWMutex list list.List } - + // Element the item type of the list. Element = list.Element ) diff --git a/container/gmap/gmap.go b/container/gmap/gmap.go index 4d0d28183..e3e22c190 100644 --- a/container/gmap/gmap.go +++ b/container/gmap/gmap.go @@ -4,7 +4,7 @@ // If a copy of the MIT was not distributed with gm file, // You can obtain one at https://github.com/gogf/gf. -// Package gmap provides concurrent-safe/unsafe map containers. +// Package gmap provides most commonly used map container which also support concurrent-safe/unsafe switch feature. package gmap type ( diff --git a/os/gcfg/gcfg.go b/os/gcfg/gcfg.go index e7aac4378..7a40edac7 100644 --- a/os/gcfg/gcfg.go +++ b/os/gcfg/gcfg.go @@ -173,12 +173,12 @@ func (c *Config) SetPath(path string) error { return nil } -// SetViolenceCheck sets whether to perform hierarchical conflict check. +// SetViolenceCheck sets whether to perform hierarchical conflict checking. // This feature needs to be enabled when there is a level symbol in the key name. -// The default is off. -// Turning on this feature is quite expensive, -// and it is not recommended to allow separators in the key names. -// It is best to avoid this on the application side. +// It is off in default. +// +// Note that, turning on this feature is quite expensive, and it is not recommended +// to allow separators in the key names. It is best to avoid this on the application side. func (c *Config) SetViolenceCheck(check bool) { c.vc = check c.Clear() @@ -186,8 +186,12 @@ func (c *Config) SetViolenceCheck(check bool) { // AddPath adds a absolute or relative path to the search paths. func (c *Config) AddPath(path string) error { - isDir := false - realPath := "" + var ( + isDir = false + realPath = "" + ) + // It firstly checks the resource manager, + // and then checks the filesystem for the path. if file := gres.Get(path); file != nil { realPath = path isDir = file.FileInfo().IsDir()