1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-06-18 22:17:44 +02:00

fix: some linting issues (#2563)

This commit is contained in:
David Brouwer
2022-09-30 16:27:07 +02:00
committed by GitHub
parent 47e6a8d725
commit 85c0b0b8eb
221 changed files with 1025 additions and 1283 deletions

View File

@ -32,7 +32,7 @@ func newRouterOptions(opt ...RouterOption) RouterOptions {
return opts
}
// WithRouterLogger sets the underline router logger
// WithRouterLogger sets the underline router logger.
func WithRouterLogger(l logger.Logger) RouterOption {
return func(o *RouterOptions) {
o.Logger = l
@ -122,49 +122,49 @@ func newOptions(opt ...Option) Options {
return opts
}
// Server name
// Server name.
func Name(n string) Option {
return func(o *Options) {
o.Name = n
}
}
// Unique server id
// Unique server id.
func Id(id string) Option {
return func(o *Options) {
o.Id = id
}
}
// Version of the service
// Version of the service.
func Version(v string) Option {
return func(o *Options) {
o.Version = v
}
}
// Address to bind to - host:port
// Address to bind to - host:port.
func Address(a string) Option {
return func(o *Options) {
o.Address = a
}
}
// The address to advertise for discovery - host:port
// The address to advertise for discovery - host:port.
func Advertise(a string) Option {
return func(o *Options) {
o.Advertise = a
}
}
// Broker to use for pub/sub
// Broker to use for pub/sub.
func Broker(b broker.Broker) Option {
return func(o *Options) {
o.Broker = b
}
}
// Codec to use to encode/decode requests for a given content type
// Codec to use to encode/decode requests for a given content type.
func Codec(contentType string, c codec.NewCodec) Option {
return func(o *Options) {
o.Codecs[contentType] = c
@ -180,56 +180,56 @@ func Context(ctx context.Context) Option {
}
}
// Registry used for discovery
// Registry used for discovery.
func Registry(r registry.Registry) Option {
return func(o *Options) {
o.Registry = r
}
}
// Tracer mechanism for distributed tracking
// Tracer mechanism for distributed tracking.
func Tracer(t trace.Tracer) Option {
return func(o *Options) {
o.Tracer = t
}
}
// Transport mechanism for communication e.g http, rabbitmq, etc
// Transport mechanism for communication e.g http, rabbitmq, etc.
func Transport(t transport.Transport) Option {
return func(o *Options) {
o.Transport = t
}
}
// Metadata associated with the server
// Metadata associated with the server.
func Metadata(md map[string]string) Option {
return func(o *Options) {
o.Metadata = md
}
}
// RegisterCheck run func before registry service
// RegisterCheck run func before registry service.
func RegisterCheck(fn func(context.Context) error) Option {
return func(o *Options) {
o.RegisterCheck = fn
}
}
// Register the service with a TTL
// Register the service with a TTL.
func RegisterTTL(t time.Duration) Option {
return func(o *Options) {
o.RegisterTTL = t
}
}
// Register the service with at interval
// Register the service with at interval.
func RegisterInterval(t time.Duration) Option {
return func(o *Options) {
o.RegisterInterval = t
}
}
// TLSConfig specifies a *tls.Config
// TLSConfig specifies a *tls.Config.
func TLSConfig(t *tls.Config) Option {
return func(o *Options) {
// set the internal tls
@ -249,14 +249,14 @@ func TLSConfig(t *tls.Config) Option {
}
}
// WithRouter sets the request router
// WithRouter sets the request router.
func WithRouter(r Router) Option {
return func(o *Options) {
o.Router = r
}
}
// WithLogger sets the underline logger
// WithLogger sets the underline logger.
func WithLogger(l logger.Logger) Option {
return func(o *Options) {
o.Logger = l
@ -279,14 +279,14 @@ func Wait(wg *sync.WaitGroup) Option {
}
}
// Adds a handler Wrapper to a list of options passed into the server
// Adds a handler Wrapper to a list of options passed into the server.
func WrapHandler(w HandlerWrapper) Option {
return func(o *Options) {
o.HdlrWrappers = append(o.HdlrWrappers, w)
}
}
// Adds a subscriber Wrapper to a list of options passed into the server
// Adds a subscriber Wrapper to a list of options passed into the server.
func WrapSubscriber(w SubscriberWrapper) Option {
return func(o *Options) {
o.SubWrappers = append(o.SubWrappers, w)
@ -294,7 +294,7 @@ func WrapSubscriber(w SubscriberWrapper) Option {
}
// Add transport.ListenOption to the ListenOptions list, when using it, it will be passed to the
// httpTransport.Listen() method
// httpTransport.Listen() method.
func ListenOption(option transport.ListenOption) Option {
return func(o *Options) {
o.ListenOptions = append(o.ListenOptions, option)