Browse Source

Modify comment syntax error (#2572)

王哈哈 2 years ago
parent
commit
dac3600b53

+ 1 - 1
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),

+ 1 - 1
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

+ 1 - 1
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)
 }

+ 1 - 1
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}
 }

+ 4 - 4
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

+ 2 - 2
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

+ 1 - 1
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")

+ 2 - 2
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

+ 1 - 1
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 {

+ 1 - 1
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
 }

+ 1 - 1
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()

+ 1 - 1
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"`

+ 2 - 2
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(),

+ 1 - 1
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()
 }

+ 1 - 1
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

+ 1 - 1
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",

+ 1 - 1
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
 }

+ 2 - 2
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
 	}

+ 1 - 1
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",

+ 2 - 2
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"

+ 1 - 1
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{}

+ 1 - 1
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",

+ 1 - 1
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{}
 }

+ 1 - 1
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,