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 {
|
func NewUnmanagedSet() *Set {
|
||||||
return &Set{
|
return &Set{
|
||||||
data: make(map[interface{}]lang.PlaceholderType),
|
data: make(map[interface{}]lang.PlaceholderType),
|
||||||
|
@ -13,7 +13,7 @@ type (
|
|||||||
// SubOption defines the method to customize a Subscriber.
|
// SubOption defines the method to customize a Subscriber.
|
||||||
SubOption func(sub *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 {
|
Subscriber struct {
|
||||||
endpoints []string
|
endpoints []string
|
||||||
exclusive bool
|
exclusive bool
|
||||||
|
@ -328,7 +328,7 @@ func (s Stream) Parallel(fn ParallelFunc, opts ...Option) {
|
|||||||
}, opts...).Done()
|
}, 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) {
|
func (s Stream) Reduce(fn ReduceFunc) (interface{}, error) {
|
||||||
return fn(s.source)
|
return fn(s.source)
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ func (nopCloser) Close() error {
|
|||||||
return nil
|
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 {
|
func NopCloser(w io.Writer) io.WriteCloser {
|
||||||
return nopCloser{w}
|
return nopCloser{w}
|
||||||
}
|
}
|
||||||
|
@ -41,7 +41,7 @@ type (
|
|||||||
opts unmarshalOptions
|
opts unmarshalOptions
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnmarshalOption defines the method to customize a Unmarshaler.
|
// UnmarshalOption defines the method to customize an Unmarshaler.
|
||||||
UnmarshalOption func(*unmarshalOptions)
|
UnmarshalOption func(*unmarshalOptions)
|
||||||
|
|
||||||
unmarshalOptions struct {
|
unmarshalOptions struct {
|
||||||
@ -50,7 +50,7 @@ type (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
// NewUnmarshaler returns a Unmarshaler.
|
// NewUnmarshaler returns an Unmarshaler.
|
||||||
func NewUnmarshaler(key string, opts ...UnmarshalOption) *Unmarshaler {
|
func NewUnmarshaler(key string, opts ...UnmarshalOption) *Unmarshaler {
|
||||||
unmarshaler := Unmarshaler{
|
unmarshaler := Unmarshaler{
|
||||||
key: key,
|
key: key,
|
||||||
@ -724,14 +724,14 @@ func (u *Unmarshaler) parseOptionsWithContext(field reflect.StructField, m Value
|
|||||||
return key, optsWithContext, nil
|
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 {
|
func WithStringValues() UnmarshalOption {
|
||||||
return func(opt *unmarshalOptions) {
|
return func(opt *unmarshalOptions) {
|
||||||
opt.fromString = true
|
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 {
|
func WithCanonicalKeyFunc(f func(string) string) UnmarshalOption {
|
||||||
return func(opt *unmarshalOptions) {
|
return func(opt *unmarshalOptions) {
|
||||||
opt.canonicalKey = f
|
opt.canonicalKey = f
|
||||||
|
@ -6,14 +6,14 @@ import (
|
|||||||
"time"
|
"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 {
|
type Unstable struct {
|
||||||
deviation float64
|
deviation float64
|
||||||
r *rand.Rand
|
r *rand.Rand
|
||||||
lock *sync.Mutex
|
lock *sync.Mutex
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewUnstable returns a Unstable.
|
// NewUnstable returns an Unstable.
|
||||||
func NewUnstable(deviation float64) Unstable {
|
func NewUnstable(deviation float64) Unstable {
|
||||||
if deviation < 0 {
|
if deviation < 0 {
|
||||||
deviation = 0
|
deviation = 0
|
||||||
|
@ -258,7 +258,7 @@ func parseUints(val string) ([]uint64, error) {
|
|||||||
return sets, nil
|
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 {
|
func runningInUserNS() bool {
|
||||||
nsOnce.Do(func() {
|
nsOnce.Do(func() {
|
||||||
file, err := os.Open("/proc/self/uid_map")
|
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
|
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 {
|
func WithExpiry(expiry time.Duration) Option {
|
||||||
return func(o *Options) {
|
return func(o *Options) {
|
||||||
o.Expiry = expiry
|
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 {
|
func WithNotFoundExpiry(expiry time.Duration) Option {
|
||||||
return func(o *Options) {
|
return func(o *Options) {
|
||||||
o.NotFoundExpiry = expiry
|
o.NotFoundExpiry = expiry
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/zeromicro/go-zero/core/stores/redis"
|
"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) {
|
func CreateRedis() (r *redis.Redis, clean func(), err error) {
|
||||||
mr, err := miniredis.Run()
|
mr, err := miniredis.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -2,7 +2,7 @@ package syncx
|
|||||||
|
|
||||||
import "sync/atomic"
|
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 {
|
type OnceGuard struct {
|
||||||
done uint32
|
done uint32
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ var (
|
|||||||
tp *sdktrace.TracerProvider
|
tp *sdktrace.TracerProvider
|
||||||
)
|
)
|
||||||
|
|
||||||
// StartAgent starts a opentelemetry agent.
|
// StartAgent starts an opentelemetry agent.
|
||||||
func StartAgent(c Config) {
|
func StartAgent(c Config) {
|
||||||
lock.Lock()
|
lock.Lock()
|
||||||
defer lock.Unlock()
|
defer lock.Unlock()
|
||||||
|
@ -3,7 +3,7 @@ package trace
|
|||||||
// TraceName represents the tracing name.
|
// TraceName represents the tracing name.
|
||||||
const TraceName = "go-zero"
|
const TraceName = "go-zero"
|
||||||
|
|
||||||
// A Config is a opentelemetry config.
|
// A Config is an opentelemetry config.
|
||||||
type Config struct {
|
type Config struct {
|
||||||
Name string `json:",optional"`
|
Name string `json:",optional"`
|
||||||
Endpoint string `json:",optional"`
|
Endpoint string `json:",optional"`
|
||||||
|
@ -7,12 +7,12 @@ import (
|
|||||||
"github.com/zeromicro/go-zero/core/timex"
|
"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 {
|
type ElapsedTimer struct {
|
||||||
start time.Duration
|
start time.Duration
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewElapsedTimer returns a ElapsedTimer.
|
// NewElapsedTimer returns an ElapsedTimer.
|
||||||
func NewElapsedTimer() *ElapsedTimer {
|
func NewElapsedTimer() *ElapsedTimer {
|
||||||
return &ElapsedTimer{
|
return &ElapsedTimer{
|
||||||
start: timex.Now(),
|
start: timex.Now(),
|
||||||
|
@ -2,7 +2,7 @@ package utils
|
|||||||
|
|
||||||
import "github.com/google/uuid"
|
import "github.com/google/uuid"
|
||||||
|
|
||||||
// NewUuid returns a uuid string.
|
// NewUuid returns an uuid string.
|
||||||
func NewUuid() string {
|
func NewUuid() string {
|
||||||
return uuid.New().String()
|
return uuid.New().String()
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ var (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type (
|
type (
|
||||||
// A AuthorizeOptions is authorize options.
|
// An AuthorizeOptions is authorize options.
|
||||||
AuthorizeOptions struct {
|
AuthorizeOptions struct {
|
||||||
PrevSecret string
|
PrevSecret string
|
||||||
Callback UnauthorizedCallback
|
Callback UnauthorizedCallback
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
// Cmd describes a api command.
|
// Cmd describes an api command.
|
||||||
Cmd = &cobra.Command{
|
Cmd = &cobra.Command{
|
||||||
Use: "api",
|
Use: "api",
|
||||||
Short: "Generate api related files",
|
Short: "Generate api related files",
|
||||||
|
@ -75,7 +75,7 @@ func (t PointerType) Documents() []string {
|
|||||||
return nil
|
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 {
|
func (t InterfaceType) Name() string {
|
||||||
return t.RawName
|
return t.RawName
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ type (
|
|||||||
Comment Doc
|
Comment Doc
|
||||||
}
|
}
|
||||||
|
|
||||||
// ApiSpec describes a api file
|
// ApiSpec describes an api file
|
||||||
ApiSpec struct {
|
ApiSpec struct {
|
||||||
Info Info
|
Info Info
|
||||||
Syntax ApiSyntax
|
Syntax ApiSyntax
|
||||||
@ -129,7 +129,7 @@ type (
|
|||||||
Value Type
|
Value Type
|
||||||
}
|
}
|
||||||
|
|
||||||
// InterfaceType describes a interface for api
|
// InterfaceType describes an interface for api
|
||||||
InterfaceType struct {
|
InterfaceType struct {
|
||||||
RawName string
|
RawName string
|
||||||
}
|
}
|
||||||
|
2
tools/goctl/env/cmd.go
vendored
2
tools/goctl/env/cmd.go
vendored
@ -8,7 +8,7 @@ var (
|
|||||||
boolVarVerbose bool
|
boolVarVerbose bool
|
||||||
boolVarInstall bool
|
boolVarInstall bool
|
||||||
|
|
||||||
// Cmd describes a env command.
|
// Cmd describes an env command.
|
||||||
Cmd = &cobra.Command{
|
Cmd = &cobra.Command{
|
||||||
Use: "env",
|
Use: "env",
|
||||||
Short: "Check or edit goctl environment",
|
Short: "Check or edit goctl environment",
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
package template
|
package template
|
||||||
|
|
||||||
const (
|
const (
|
||||||
// Imports defines a import template for model in cache case
|
// Imports defines an import template for model in cache case
|
||||||
Imports = `import (
|
Imports = `import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
@ -17,7 +17,7 @@ const (
|
|||||||
"github.com/zeromicro/go-zero/core/stringx"
|
"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 (
|
ImportsNoCache = `import (
|
||||||
"context"
|
"context"
|
||||||
"database/sql"
|
"database/sql"
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
|
|
||||||
var (
|
var (
|
||||||
ErrInvalidKVExpression = errors.New(`invalid key-value expression`)
|
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{}
|
type KV []interface{}
|
||||||
|
@ -2,7 +2,7 @@ package upgrade
|
|||||||
|
|
||||||
import "github.com/spf13/cobra"
|
import "github.com/spf13/cobra"
|
||||||
|
|
||||||
// Cmd describes a upgrade command.
|
// Cmd describes an upgrade command.
|
||||||
var Cmd = &cobra.Command{
|
var Cmd = &cobra.Command{
|
||||||
Use: "upgrade",
|
Use: "upgrade",
|
||||||
Short: "Upgrade goctl to latest version",
|
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 {
|
func NewIdeaConsole() Console {
|
||||||
return &ideaConsole{}
|
return &ideaConsole{}
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,7 @@ type DefaultTemplate struct {
|
|||||||
goFmt bool
|
goFmt bool
|
||||||
}
|
}
|
||||||
|
|
||||||
// With returns a instance of DefaultTemplate
|
// With returns an instance of DefaultTemplate
|
||||||
func With(name string) *DefaultTemplate {
|
func With(name string) *DefaultTemplate {
|
||||||
return &DefaultTemplate{
|
return &DefaultTemplate{
|
||||||
name: name,
|
name: name,
|
||||||
|
Loading…
Reference in New Issue
Block a user