From 4f4109cdb6ffca5836714ab303f3dfe5c61eba76 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=8E=8B=E5=93=88=E5=93=88?= <31426858+wanghaha-dev@users.noreply.github.com> Date: Mon, 7 Nov 2022 17:55:49 +0800 Subject: [PATCH] fix typo for comments (#2268) * Modify comment syntax error * Modify comment syntax error --- container/garray/garray_normal_any.go | 2 +- container/garray/garray_normal_int.go | 2 +- container/garray/garray_sorted_any.go | 2 +- container/garray/garray_sorted_int.go | 2 +- container/gset/gset_any_set.go | 2 +- container/gset/gset_int_set.go | 2 +- container/gset/gset_str_set.go | 2 +- container/gset/gset_z_example_int_test.go | 2 +- container/gset/gset_z_example_str_test.go | 2 +- contrib/drivers/sqlite/sqlite.go | 2 +- encoding/gurl/url.go | 4 ++-- net/gclient/gclient_bytes.go | 2 +- net/gclient/gclient_var.go | 2 +- net/gclient/gclient_z_example_test.go | 2 +- net/goai/goai.go | 2 +- net/gudp/gudp_conn.go | 2 +- net/gudp/gudp_server.go | 4 ++-- os/gspath/gspath.go | 8 ++++---- os/gtimer/gtimer_queue.go | 2 +- util/gpage/gpage.go | 2 +- util/grand/grand_buffer.go | 2 +- util/gvalid/gvalid_z_unit_feature_recursive_test.go | 2 +- 22 files changed, 27 insertions(+), 27 deletions(-) diff --git a/container/garray/garray_normal_any.go b/container/garray/garray_normal_any.go index dada3606b..52fb3b246 100644 --- a/container/garray/garray_normal_any.go +++ b/container/garray/garray_normal_any.go @@ -53,7 +53,7 @@ func NewArraySize(size int, cap int, safe ...bool) *Array { } } -// NewArrayRange creates and returns a array by a range from `start` to `end` +// NewArrayRange creates and returns an array by a range from `start` to `end` // with step value `step`. func NewArrayRange(start, end, step int, safe ...bool) *Array { if step == 0 { diff --git a/container/garray/garray_normal_int.go b/container/garray/garray_normal_int.go index cf2ca1cb1..d8b5e2f34 100644 --- a/container/garray/garray_normal_int.go +++ b/container/garray/garray_normal_int.go @@ -45,7 +45,7 @@ func NewIntArraySize(size int, cap int, safe ...bool) *IntArray { } } -// NewIntArrayRange creates and returns a array by a range from `start` to `end` +// NewIntArrayRange creates and returns an array by a range from `start` to `end` // with step value `step`. func NewIntArrayRange(start, end, step int, safe ...bool) *IntArray { if step == 0 { diff --git a/container/garray/garray_sorted_any.go b/container/garray/garray_sorted_any.go index a4aafa192..73a772a55 100644 --- a/container/garray/garray_sorted_any.go +++ b/container/garray/garray_sorted_any.go @@ -55,7 +55,7 @@ func NewSortedArraySize(cap int, comparator func(a, b interface{}) int, safe ... } } -// NewSortedArrayRange creates and returns a array by a range from `start` to `end` +// NewSortedArrayRange creates and returns an array by a range from `start` to `end` // with step value `step`. func NewSortedArrayRange(start, end, step int, comparator func(a, b interface{}) int, safe ...bool) *SortedArray { if step == 0 { diff --git a/container/garray/garray_sorted_int.go b/container/garray/garray_sorted_int.go index 7090c6823..32ab672f0 100644 --- a/container/garray/garray_sorted_int.go +++ b/container/garray/garray_sorted_int.go @@ -56,7 +56,7 @@ func NewSortedIntArraySize(cap int, safe ...bool) *SortedIntArray { } } -// NewSortedIntArrayRange creates and returns a array by a range from `start` to `end` +// NewSortedIntArrayRange creates and returns an array by a range from `start` to `end` // with step value `step`. func NewSortedIntArrayRange(start, end, step int, safe ...bool) *SortedIntArray { if step == 0 { diff --git a/container/gset/gset_any_set.go b/container/gset/gset_any_set.go index 28f2e3941..179862ca6 100644 --- a/container/gset/gset_any_set.go +++ b/container/gset/gset_any_set.go @@ -184,7 +184,7 @@ func (set *Set) Clear() { set.mu.Unlock() } -// Slice returns the a of items of the set as slice. +// Slice returns the an of items of the set as slice. func (set *Set) Slice() []interface{} { set.mu.RLock() var ( diff --git a/container/gset/gset_int_set.go b/container/gset/gset_int_set.go index aa5b0da6e..b29ebfd03 100644 --- a/container/gset/gset_int_set.go +++ b/container/gset/gset_int_set.go @@ -165,7 +165,7 @@ func (set *IntSet) Clear() { set.mu.Unlock() } -// Slice returns the a of items of the set as slice. +// Slice returns the an of items of the set as slice. func (set *IntSet) Slice() []int { set.mu.RLock() var ( diff --git a/container/gset/gset_str_set.go b/container/gset/gset_str_set.go index 10b603096..386ba6b20 100644 --- a/container/gset/gset_str_set.go +++ b/container/gset/gset_str_set.go @@ -178,7 +178,7 @@ func (set *StrSet) Clear() { set.mu.Unlock() } -// Slice returns the a of items of the set as slice. +// Slice returns the an of items of the set as slice. func (set *StrSet) Slice() []string { set.mu.RLock() var ( diff --git a/container/gset/gset_z_example_int_test.go b/container/gset/gset_z_example_int_test.go index 589b34a21..4efbd25f2 100644 --- a/container/gset/gset_z_example_int_test.go +++ b/container/gset/gset_z_example_int_test.go @@ -313,7 +313,7 @@ func ExampleIntSet_Size() { // 4 } -// Slice returns the a of items of the set as slice. +// Slice returns the an of items of the set as slice. func ExampleIntSet_Slice() { s1 := gset.NewIntSet() s1.Add([]int{1, 2, 3, 4}...) diff --git a/container/gset/gset_z_example_str_test.go b/container/gset/gset_z_example_str_test.go index b81df2f04..69fe34fb7 100644 --- a/container/gset/gset_z_example_str_test.go +++ b/container/gset/gset_z_example_str_test.go @@ -325,7 +325,7 @@ func ExampleStrSet_Size() { // 4 } -// Slice returns the a of items of the set as slice. +// Slice returns the an of items of the set as slice. func ExampleStrSet_Slice() { s1 := gset.NewStrSet(true) s1.Add([]string{"a", "b", "c", "d"}...) diff --git a/contrib/drivers/sqlite/sqlite.go b/contrib/drivers/sqlite/sqlite.go index 36aa7f951..0f4ddae76 100644 --- a/contrib/drivers/sqlite/sqlite.go +++ b/contrib/drivers/sqlite/sqlite.go @@ -52,7 +52,7 @@ func (d *Driver) New(core *gdb.Core, node *gdb.ConfigNode) (gdb.DB, error) { }, nil } -// Open creates and returns a underlying sql.DB object for sqlite. +// Open creates and returns an underlying sql.DB object for sqlite. // https://github.com/glebarez/go-sqlite func (d *Driver) Open(config *gdb.ConfigNode) (db *sql.DB, err error) { var ( diff --git a/encoding/gurl/url.go b/encoding/gurl/url.go index 21b9b74ee..b4ee072c8 100644 --- a/encoding/gurl/url.go +++ b/encoding/gurl/url.go @@ -15,7 +15,7 @@ import ( ) // Encode escapes the string so it can be safely placed -// inside a URL query. +// inside an URL query. func Encode(str string) string { return url.QueryEscape(str) } @@ -49,7 +49,7 @@ func BuildQuery(queryData url.Values) string { return queryData.Encode() } -// ParseURL Parse a URL and return its components. +// ParseURL Parse an URL and return its components. // -1: all; 1: scheme; 2: host; 4: port; 8: user; 16: pass; 32: path; 64: query; 128: fragment. // See http://php.net/manual/en/function.parse-url.php. func ParseURL(str string, component int) (map[string]string, error) { diff --git a/net/gclient/gclient_bytes.go b/net/gclient/gclient_bytes.go index bfdc85e41..1899b920e 100644 --- a/net/gclient/gclient_bytes.go +++ b/net/gclient/gclient_bytes.go @@ -48,7 +48,7 @@ func (c *Client) ConnectBytes(ctx context.Context, url string, data ...interface return c.RequestBytes(ctx, http.MethodConnect, url, data...) } -// OptionsBytes sends a OPTIONS request, retrieves and returns the result content as bytes. +// OptionsBytes sends an OPTIONS request, retrieves and returns the result content as bytes. func (c *Client) OptionsBytes(ctx context.Context, url string, data ...interface{}) []byte { return c.RequestBytes(ctx, http.MethodOptions, url, data...) } diff --git a/net/gclient/gclient_var.go b/net/gclient/gclient_var.go index 950f96ac0..977c1b2e1 100644 --- a/net/gclient/gclient_var.go +++ b/net/gclient/gclient_var.go @@ -55,7 +55,7 @@ func (c *Client) ConnectVar(ctx context.Context, url string, data ...interface{} return c.RequestVar(ctx, http.MethodConnect, url, data...) } -// OptionsVar sends a OPTIONS request, retrieves and converts the result content to specified pointer. +// OptionsVar sends an OPTIONS request, retrieves and converts the result content to specified pointer. // The parameter `pointer` can be type of: struct/*struct/**struct/[]struct/[]*struct/*[]struct, etc. func (c *Client) OptionsVar(ctx context.Context, url string, data ...interface{}) *gvar.Var { return c.RequestVar(ctx, http.MethodOptions, url, data...) diff --git a/net/gclient/gclient_z_example_test.go b/net/gclient/gclient_z_example_test.go index 5c274f869..b68b050a5 100644 --- a/net/gclient/gclient_z_example_test.go +++ b/net/gclient/gclient_z_example_test.go @@ -524,7 +524,7 @@ func ExampleClient_GetVar() { // &{1 john} } -// ExampleClient_SetProxy a example for `gclient.Client.SetProxy` method. +// ExampleClient_SetProxy an example for `gclient.Client.SetProxy` method. // please prepare two proxy server before running this example. // http proxy server listening on `127.0.0.1:1081` // socks5 proxy server listening on `127.0.0.1:1080` diff --git a/net/goai/goai.go b/net/goai/goai.go index 1fc8d74fd..f7d1ce35e 100644 --- a/net/goai/goai.go +++ b/net/goai/goai.go @@ -81,7 +81,7 @@ var ( } ) -// New creates and returns a OpenApiV3 implements object. +// New creates and returns an OpenApiV3 implements object. func New() *OpenApiV3 { oai := &OpenApiV3{} oai.fillWithDefaultValue() diff --git a/net/gudp/gudp_conn.go b/net/gudp/gudp_conn.go index 6111f092d..a3cc6884b 100644 --- a/net/gudp/gudp_conn.go +++ b/net/gudp/gudp_conn.go @@ -44,7 +44,7 @@ func NewConn(remoteAddress string, localAddress ...string) (*Conn, error) { } } -// NewConnByNetConn creates a UDP connection object with given *net.UDPConn object. +// NewConnByNetConn creates an UDP connection object with given *net.UDPConn object. func NewConnByNetConn(udp *net.UDPConn) *Conn { return &Conn{ UDPConn: udp, diff --git a/net/gudp/gudp_server.go b/net/gudp/gudp_server.go index c6dd52b68..c60edd8e9 100644 --- a/net/gudp/gudp_server.go +++ b/net/gudp/gudp_server.go @@ -40,7 +40,7 @@ var ( serverMapping = gmap.NewStrAnyMap(true) ) -// GetServer creates and returns a UDP server instance with given name. +// GetServer creates and returns an UDP server instance with given name. func GetServer(name ...interface{}) *Server { serverName := defaultServer if len(name) > 0 && name[0] != "" { @@ -54,7 +54,7 @@ func GetServer(name ...interface{}) *Server { return s } -// NewServer creates and returns a UDP server. +// NewServer creates and returns an UDP server. // The optional parameter `name` is used to specify its name, which can be used for // GetServer function to retrieve its instance. func NewServer(address string, handler func(*Conn), name ...string) *Server { diff --git a/os/gspath/gspath.go b/os/gspath/gspath.go index f036b75d3..12fdbe70c 100644 --- a/os/gspath/gspath.go +++ b/os/gspath/gspath.go @@ -59,7 +59,7 @@ func New(path string, cache bool) *SPath { return sp } -// Get creates and returns a instance of searching manager for given path. +// Get creates and returns an instance of searching manager for given path. // The parameter `cache` specifies whether using cache feature for this manager. // If cache feature is enabled, it asynchronously and recursively scans the path // and updates all sub files/folders to the cache using package gfsnotify. @@ -73,7 +73,7 @@ func Get(root string, cache bool) *SPath { } // Search searches file `name` under path `root`. -// The parameter `root` should be a absolute path. It will not automatically +// The parameter `root` should be an absolute path. It will not automatically // convert `root` to absolute path for performance reason. // The optional parameter `indexFiles` specifies the searching index files when the result is a directory. // For example, if the result `filePath` is a directory, and `indexFiles` is [index.html, main.html], it will also @@ -84,7 +84,7 @@ func Search(root string, name string, indexFiles ...string) (filePath string, is } // SearchWithCache searches file `name` under path `root` with cache feature enabled. -// The parameter `root` should be a absolute path. It will not automatically +// The parameter `root` should be an absolute path. It will not automatically // convert `root` to absolute path for performance reason. // The optional parameter `indexFiles` specifies the searching index files when the result is a directory. // For example, if the result `filePath` is a directory, and `indexFiles` is [index.html, main.html], it will also @@ -215,7 +215,7 @@ func (sp *SPath) Search(name string, indexFiles ...string) (filePath string, isD } // Remove deletes the `path` from cache files of the manager. -// The parameter `path` can be either a absolute path or just a relative file name. +// The parameter `path` can be either an absolute path or just a relative file name. func (sp *SPath) Remove(path string) { if sp.cache == nil { return diff --git a/os/gtimer/gtimer_queue.go b/os/gtimer/gtimer_queue.go index 08fdd46f3..92b575231 100644 --- a/os/gtimer/gtimer_queue.go +++ b/os/gtimer/gtimer_queue.go @@ -24,7 +24,7 @@ type priorityQueue struct { nextPriority *gtype.Int64 // nextPriority stores the next priority value of the heap, which is used to check if necessary to call the Pop of heap by Timer. } -// priorityQueueHeap is a heap manager, of which the underlying `array` is a array implementing a heap structure. +// priorityQueueHeap is a heap manager, of which the underlying `array` is an array implementing a heap structure. type priorityQueueHeap struct { array []priorityQueueItem } diff --git a/util/gpage/gpage.go b/util/gpage/gpage.go index af400d9b7..1570ff1e2 100644 --- a/util/gpage/gpage.go +++ b/util/gpage/gpage.go @@ -204,7 +204,7 @@ func (p *Page) GetContent(mode int) string { } // GetUrl parses the UrlTemplate with given page number and returns the URL string. -// Note that the UrlTemplate attribute can be either an URL or a URI string with "{.page}" +// Note that the UrlTemplate attribute can be either an URL or an URI string with "{.page}" // place holder specifying the page number position. func (p *Page) GetUrl(page int) string { return gstr.Replace(p.UrlTemplate, DefaultPagePlaceHolder, gconv.String(page)) diff --git a/util/grand/grand_buffer.go b/util/grand/grand_buffer.go index 4b101829a..4527c25a2 100644 --- a/util/grand/grand_buffer.go +++ b/util/grand/grand_buffer.go @@ -28,7 +28,7 @@ func init() { go asyncProducingRandomBufferBytesLoop() } -// asyncProducingRandomBufferBytes is a named goroutine, which uses a asynchronous goroutine +// asyncProducingRandomBufferBytes is a named goroutine, which uses an asynchronous goroutine // to produce the random bytes, and a buffer chan to store the random bytes. // So it has high performance to generate random numbers. func asyncProducingRandomBufferBytesLoop() { diff --git a/util/gvalid/gvalid_z_unit_feature_recursive_test.go b/util/gvalid/gvalid_z_unit_feature_recursive_test.go index ab3449eba..254b5dc6f 100755 --- a/util/gvalid/gvalid_z_unit_feature_recursive_test.go +++ b/util/gvalid/gvalid_z_unit_feature_recursive_test.go @@ -344,7 +344,7 @@ func Test_CheckStruct_Recursively_MapAttribute(t *testing.T) { // https://github.com/gogf/gf/issues/1983 func Test_Issue1983(t *testing.T) { - // Error as the attribute Student in Teacher is a initialized struct, which has default value. + // Error as the attribute Student in Teacher is an initialized struct, which has default value. gtest.C(t, func(t *gtest.T) { type Student struct { Name string `v:"required"`