From dac3600b532f0ce399e8d9b6acb5838e0f0d48cc 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: Fri, 4 Nov 2022 21:55:17 +0800 Subject: [PATCH] Modify comment syntax error (#2572) --- core/collection/set.go | 2 +- core/discov/subscriber.go | 2 +- core/fx/stream.go | 2 +- core/iox/nopcloser.go | 2 +- core/mapping/unmarshaler.go | 8 ++++---- core/mathx/unstable.go | 4 ++-- core/stat/internal/cgroup_linux.go | 2 +- core/stores/cache/cacheopt.go | 4 ++-- core/stores/redis/redistest/redistest.go | 2 +- core/syncx/onceguard.go | 2 +- core/trace/agent.go | 2 +- core/trace/config.go | 2 +- core/utils/times.go | 4 ++-- core/utils/uuid.go | 2 +- rest/handler/authhandler.go | 2 +- tools/goctl/api/cmd.go | 2 +- tools/goctl/api/spec/name.go | 2 +- tools/goctl/api/spec/spec.go | 4 ++-- tools/goctl/env/cmd.go | 2 +- tools/goctl/model/sql/template/import.go | 4 ++-- tools/goctl/pkg/collection/sortedmap.go | 2 +- tools/goctl/upgrade/cmd.go | 2 +- tools/goctl/util/console/console.go | 2 +- tools/goctl/util/templatex.go | 2 +- 24 files changed, 32 insertions(+), 32 deletions(-) diff --git a/core/collection/set.go b/core/collection/set.go index d95f9e5b..e067ae23 100644 --- a/core/collection/set.go +++ b/core/collection/set.go @@ -29,7 +29,7 @@ func NewSet() *Set { } } -// NewUnmanagedSet returns a unmanaged Set, which can put values with different types. +// NewUnmanagedSet returns an unmanaged Set, which can put values with different types. func NewUnmanagedSet() *Set { return &Set{ data: make(map[interface{}]lang.PlaceholderType), diff --git a/core/discov/subscriber.go b/core/discov/subscriber.go index 3a38a4c1..809dee2a 100644 --- a/core/discov/subscriber.go +++ b/core/discov/subscriber.go @@ -13,7 +13,7 @@ type ( // SubOption defines the method to customize a Subscriber. SubOption func(sub *Subscriber) - // A Subscriber is used to subscribe the given key on a etcd cluster. + // A Subscriber is used to subscribe the given key on an etcd cluster. Subscriber struct { endpoints []string exclusive bool diff --git a/core/fx/stream.go b/core/fx/stream.go index 4d791b52..af235f12 100644 --- a/core/fx/stream.go +++ b/core/fx/stream.go @@ -328,7 +328,7 @@ func (s Stream) Parallel(fn ParallelFunc, opts ...Option) { }, opts...).Done() } -// Reduce is a utility method to let the caller deal with the underlying channel. +// Reduce is an utility method to let the caller deal with the underlying channel. func (s Stream) Reduce(fn ReduceFunc) (interface{}, error) { return fn(s.source) } diff --git a/core/iox/nopcloser.go b/core/iox/nopcloser.go index ba27a9f4..f3c12300 100644 --- a/core/iox/nopcloser.go +++ b/core/iox/nopcloser.go @@ -10,7 +10,7 @@ func (nopCloser) Close() error { return nil } -// NopCloser returns a io.WriteCloser that does nothing on calling Close. +// NopCloser returns an io.WriteCloser that does nothing on calling Close. func NopCloser(w io.Writer) io.WriteCloser { return nopCloser{w} } diff --git a/core/mapping/unmarshaler.go b/core/mapping/unmarshaler.go index ae0e8468..3f52f1fb 100644 --- a/core/mapping/unmarshaler.go +++ b/core/mapping/unmarshaler.go @@ -41,7 +41,7 @@ type ( opts unmarshalOptions } - // UnmarshalOption defines the method to customize a Unmarshaler. + // UnmarshalOption defines the method to customize an Unmarshaler. UnmarshalOption func(*unmarshalOptions) unmarshalOptions struct { @@ -50,7 +50,7 @@ type ( } ) -// NewUnmarshaler returns a Unmarshaler. +// NewUnmarshaler returns an Unmarshaler. func NewUnmarshaler(key string, opts ...UnmarshalOption) *Unmarshaler { unmarshaler := Unmarshaler{ key: key, @@ -724,14 +724,14 @@ func (u *Unmarshaler) parseOptionsWithContext(field reflect.StructField, m Value return key, optsWithContext, nil } -// WithStringValues customizes a Unmarshaler with number values from strings. +// WithStringValues customizes an Unmarshaler with number values from strings. func WithStringValues() UnmarshalOption { return func(opt *unmarshalOptions) { opt.fromString = true } } -// WithCanonicalKeyFunc customizes a Unmarshaler with Canonical Key func +// WithCanonicalKeyFunc customizes an Unmarshaler with Canonical Key func func WithCanonicalKeyFunc(f func(string) string) UnmarshalOption { return func(opt *unmarshalOptions) { opt.canonicalKey = f diff --git a/core/mathx/unstable.go b/core/mathx/unstable.go index 33dfda5a..d740b454 100644 --- a/core/mathx/unstable.go +++ b/core/mathx/unstable.go @@ -6,14 +6,14 @@ import ( "time" ) -// A Unstable is used to generate random value around the mean value base on given deviation. +// An Unstable is used to generate random value around the mean value base on given deviation. type Unstable struct { deviation float64 r *rand.Rand lock *sync.Mutex } -// NewUnstable returns a Unstable. +// NewUnstable returns an Unstable. func NewUnstable(deviation float64) Unstable { if deviation < 0 { deviation = 0 diff --git a/core/stat/internal/cgroup_linux.go b/core/stat/internal/cgroup_linux.go index d9d025f0..1a0a5636 100644 --- a/core/stat/internal/cgroup_linux.go +++ b/core/stat/internal/cgroup_linux.go @@ -258,7 +258,7 @@ func parseUints(val string) ([]uint64, error) { return sets, nil } -// runningInUserNS detects whether we are currently running in a user namespace. +// runningInUserNS detects whether we are currently running in an user namespace. func runningInUserNS() bool { nsOnce.Do(func() { file, err := os.Open("/proc/self/uid_map") diff --git a/core/stores/cache/cacheopt.go b/core/stores/cache/cacheopt.go index 32b5d851..cc8d459d 100644 --- a/core/stores/cache/cacheopt.go +++ b/core/stores/cache/cacheopt.go @@ -34,14 +34,14 @@ func newOptions(opts ...Option) Options { return o } -// WithExpiry returns a func to customize a Options with given expiry. +// WithExpiry returns a func to customize an Options with given expiry. func WithExpiry(expiry time.Duration) Option { return func(o *Options) { o.Expiry = expiry } } -// WithNotFoundExpiry returns a func to customize a Options with given not found expiry. +// WithNotFoundExpiry returns a func to customize an Options with given not found expiry. func WithNotFoundExpiry(expiry time.Duration) Option { return func(o *Options) { o.NotFoundExpiry = expiry diff --git a/core/stores/redis/redistest/redistest.go b/core/stores/redis/redistest/redistest.go index 35f634af..82a1128c 100644 --- a/core/stores/redis/redistest/redistest.go +++ b/core/stores/redis/redistest/redistest.go @@ -8,7 +8,7 @@ import ( "github.com/zeromicro/go-zero/core/stores/redis" ) -// CreateRedis returns a in process redis.Redis. +// CreateRedis returns an in process redis.Redis. func CreateRedis() (r *redis.Redis, clean func(), err error) { mr, err := miniredis.Run() if err != nil { diff --git a/core/syncx/onceguard.go b/core/syncx/onceguard.go index c6b867e3..5f473616 100644 --- a/core/syncx/onceguard.go +++ b/core/syncx/onceguard.go @@ -2,7 +2,7 @@ package syncx import "sync/atomic" -// A OnceGuard is used to make sure a resource can be taken once. +// An OnceGuard is used to make sure a resource can be taken once. type OnceGuard struct { done uint32 } diff --git a/core/trace/agent.go b/core/trace/agent.go index 3473b4de..6ab15e87 100644 --- a/core/trace/agent.go +++ b/core/trace/agent.go @@ -29,7 +29,7 @@ var ( tp *sdktrace.TracerProvider ) -// StartAgent starts a opentelemetry agent. +// StartAgent starts an opentelemetry agent. func StartAgent(c Config) { lock.Lock() defer lock.Unlock() diff --git a/core/trace/config.go b/core/trace/config.go index 02f049a3..099573b9 100644 --- a/core/trace/config.go +++ b/core/trace/config.go @@ -3,7 +3,7 @@ package trace // TraceName represents the tracing name. const TraceName = "go-zero" -// A Config is a opentelemetry config. +// A Config is an opentelemetry config. type Config struct { Name string `json:",optional"` Endpoint string `json:",optional"` diff --git a/core/utils/times.go b/core/utils/times.go index 1c6ee4cc..6fb0a28f 100644 --- a/core/utils/times.go +++ b/core/utils/times.go @@ -7,12 +7,12 @@ import ( "github.com/zeromicro/go-zero/core/timex" ) -// A ElapsedTimer is a timer to track the elapsed time. +// An ElapsedTimer is a timer to track the elapsed time. type ElapsedTimer struct { start time.Duration } -// NewElapsedTimer returns a ElapsedTimer. +// NewElapsedTimer returns an ElapsedTimer. func NewElapsedTimer() *ElapsedTimer { return &ElapsedTimer{ start: timex.Now(), diff --git a/core/utils/uuid.go b/core/utils/uuid.go index 3fa80829..931bdfad 100644 --- a/core/utils/uuid.go +++ b/core/utils/uuid.go @@ -2,7 +2,7 @@ package utils import "github.com/google/uuid" -// NewUuid returns a uuid string. +// NewUuid returns an uuid string. func NewUuid() string { return uuid.New().String() } diff --git a/rest/handler/authhandler.go b/rest/handler/authhandler.go index c45ee81a..f72e2113 100644 --- a/rest/handler/authhandler.go +++ b/rest/handler/authhandler.go @@ -29,7 +29,7 @@ var ( ) type ( - // A AuthorizeOptions is authorize options. + // An AuthorizeOptions is authorize options. AuthorizeOptions struct { PrevSecret string Callback UnauthorizedCallback diff --git a/tools/goctl/api/cmd.go b/tools/goctl/api/cmd.go index 71667c1b..2218a966 100644 --- a/tools/goctl/api/cmd.go +++ b/tools/goctl/api/cmd.go @@ -16,7 +16,7 @@ import ( ) var ( - // Cmd describes a api command. + // Cmd describes an api command. Cmd = &cobra.Command{ Use: "api", Short: "Generate api related files", diff --git a/tools/goctl/api/spec/name.go b/tools/goctl/api/spec/name.go index 37ec72f4..705f145d 100644 --- a/tools/goctl/api/spec/name.go +++ b/tools/goctl/api/spec/name.go @@ -75,7 +75,7 @@ func (t PointerType) Documents() []string { return nil } -// Name returns a interface string, Its fixed value is interface{} +// Name returns an interface string, Its fixed value is interface{} func (t InterfaceType) Name() string { return t.RawName } diff --git a/tools/goctl/api/spec/spec.go b/tools/goctl/api/spec/spec.go index 1410843e..4c8c3f2b 100644 --- a/tools/goctl/api/spec/spec.go +++ b/tools/goctl/api/spec/spec.go @@ -19,7 +19,7 @@ type ( Comment Doc } - // ApiSpec describes a api file + // ApiSpec describes an api file ApiSpec struct { Info Info Syntax ApiSyntax @@ -129,7 +129,7 @@ type ( Value Type } - // InterfaceType describes a interface for api + // InterfaceType describes an interface for api InterfaceType struct { RawName string } diff --git a/tools/goctl/env/cmd.go b/tools/goctl/env/cmd.go index 51decb96..58b7e112 100644 --- a/tools/goctl/env/cmd.go +++ b/tools/goctl/env/cmd.go @@ -8,7 +8,7 @@ var ( boolVarVerbose bool boolVarInstall bool - // Cmd describes a env command. + // Cmd describes an env command. Cmd = &cobra.Command{ Use: "env", Short: "Check or edit goctl environment", diff --git a/tools/goctl/model/sql/template/import.go b/tools/goctl/model/sql/template/import.go index d2f69899..cfb6cf0e 100644 --- a/tools/goctl/model/sql/template/import.go +++ b/tools/goctl/model/sql/template/import.go @@ -1,7 +1,7 @@ package template const ( - // Imports defines a import template for model in cache case + // Imports defines an import template for model in cache case Imports = `import ( "context" "database/sql" @@ -17,7 +17,7 @@ const ( "github.com/zeromicro/go-zero/core/stringx" ) ` - // ImportsNoCache defines a import template for model in normal case + // ImportsNoCache defines an import template for model in normal case ImportsNoCache = `import ( "context" "database/sql" diff --git a/tools/goctl/pkg/collection/sortedmap.go b/tools/goctl/pkg/collection/sortedmap.go index 3d4a5506..0a51ce20 100644 --- a/tools/goctl/pkg/collection/sortedmap.go +++ b/tools/goctl/pkg/collection/sortedmap.go @@ -11,7 +11,7 @@ import ( var ( ErrInvalidKVExpression = errors.New(`invalid key-value expression`) - ErrInvalidKVS = errors.New("the length of kv must be a even number") + ErrInvalidKVS = errors.New("the length of kv must be an even number") ) type KV []interface{} diff --git a/tools/goctl/upgrade/cmd.go b/tools/goctl/upgrade/cmd.go index 73466817..bcbd6d2a 100644 --- a/tools/goctl/upgrade/cmd.go +++ b/tools/goctl/upgrade/cmd.go @@ -2,7 +2,7 @@ package upgrade import "github.com/spf13/cobra" -// Cmd describes a upgrade command. +// Cmd describes an upgrade command. var Cmd = &cobra.Command{ Use: "upgrade", Short: "Upgrade goctl to latest version", diff --git a/tools/goctl/util/console/console.go b/tools/goctl/util/console/console.go index 998dbec0..87c8bdba 100644 --- a/tools/goctl/util/console/console.go +++ b/tools/goctl/util/console/console.go @@ -115,7 +115,7 @@ func (c *colorConsole) Must(err error) { } } -// NewIdeaConsole returns a instance of ideaConsole +// NewIdeaConsole returns an instance of ideaConsole func NewIdeaConsole() Console { return &ideaConsole{} } diff --git a/tools/goctl/util/templatex.go b/tools/goctl/util/templatex.go index f30c54d9..5d35f6a6 100644 --- a/tools/goctl/util/templatex.go +++ b/tools/goctl/util/templatex.go @@ -19,7 +19,7 @@ type DefaultTemplate struct { goFmt bool } -// With returns a instance of DefaultTemplate +// With returns an instance of DefaultTemplate func With(name string) *DefaultTemplate { return &DefaultTemplate{ name: name,