mirror of
https://github.com/zeromicro/go-zero.git
synced 2025-02-02 16:28:39 +08:00
Modify comment syntax error (#2572)
This commit is contained in:
parent
3db64c7d47
commit
dac3600b53
@ -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),
|
||||
|
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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}
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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")
|
||||
|
4
core/stores/cache/cacheopt.go
vendored
4
core/stores/cache/cacheopt.go
vendored
@ -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
|
||||
|
@ -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 {
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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()
|
||||
|
@ -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"`
|
||||
|
@ -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(),
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ var (
|
||||
)
|
||||
|
||||
type (
|
||||
// A AuthorizeOptions is authorize options.
|
||||
// An AuthorizeOptions is authorize options.
|
||||
AuthorizeOptions struct {
|
||||
PrevSecret string
|
||||
Callback UnauthorizedCallback
|
||||
|
@ -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",
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -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
|
||||
}
|
||||
|
2
tools/goctl/env/cmd.go
vendored
2
tools/goctl/env/cmd.go
vendored
@ -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",
|
||||
|
@ -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"
|
||||
|
@ -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{}
|
||||
|
@ -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",
|
||||
|
@ -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{}
|
||||
}
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user