mirror of
https://github.com/go-micro/go-micro.git
synced 2025-11-23 21:44:41 +02:00
fix: some linting issues (#2563)
This commit is contained in:
@@ -12,7 +12,7 @@ import (
|
||||
"go-micro.dev/v4/registry"
|
||||
)
|
||||
|
||||
// Options for web
|
||||
// Options for web.
|
||||
type Options struct {
|
||||
Name string
|
||||
Version string
|
||||
@@ -79,14 +79,14 @@ func newOptions(opts ...Option) Options {
|
||||
return opt
|
||||
}
|
||||
|
||||
// Name of Web
|
||||
// Name of Web.
|
||||
func Name(n string) Option {
|
||||
return func(o *Options) {
|
||||
o.Name = n
|
||||
}
|
||||
}
|
||||
|
||||
// Icon specifies an icon url to load in the UI
|
||||
// Icon specifies an icon url to load in the UI.
|
||||
func Icon(ico string) Option {
|
||||
return func(o *Options) {
|
||||
if o.Metadata == nil {
|
||||
@@ -96,35 +96,35 @@ func Icon(ico string) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// Id for Unique server id
|
||||
// Id for 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
|
||||
}
|
||||
}
|
||||
|
||||
// Metadata associated with the service
|
||||
// Metadata associated with the service.
|
||||
func Metadata(md map[string]string) Option {
|
||||
return func(o *Options) {
|
||||
o.Metadata = md
|
||||
}
|
||||
}
|
||||
|
||||
// Address to bind to - host:port
|
||||
// Address to bind to - host:port.
|
||||
func Address(a string) Option {
|
||||
return func(o *Options) {
|
||||
o.Address = a
|
||||
}
|
||||
}
|
||||
|
||||
// Advertise The address to advertise for discovery - host:port
|
||||
// Advertise The address to advertise for discovery - host:port.
|
||||
func Advertise(a string) Option {
|
||||
return func(o *Options) {
|
||||
o.Advertise = a
|
||||
@@ -140,42 +140,42 @@ 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
|
||||
}
|
||||
}
|
||||
|
||||
// RegisterTTL Register the service with a TTL
|
||||
// RegisterTTL Register the service with a TTL.
|
||||
func RegisterTTL(t time.Duration) Option {
|
||||
return func(o *Options) {
|
||||
o.RegisterTTL = t
|
||||
}
|
||||
}
|
||||
|
||||
// RegisterInterval Register the service with at interval
|
||||
// RegisterInterval Register the service with at interval.
|
||||
func RegisterInterval(t time.Duration) Option {
|
||||
return func(o *Options) {
|
||||
o.RegisterInterval = t
|
||||
}
|
||||
}
|
||||
|
||||
// Handler for custom handler
|
||||
// Handler for custom handler.
|
||||
func Handler(h http.Handler) Option {
|
||||
return func(o *Options) {
|
||||
o.Handler = h
|
||||
}
|
||||
}
|
||||
|
||||
// Server for custom Server
|
||||
// Server for custom Server.
|
||||
func Server(srv *http.Server) Option {
|
||||
return func(o *Options) {
|
||||
o.Server = srv
|
||||
}
|
||||
}
|
||||
|
||||
// MicroService sets the micro.Service used internally
|
||||
// MicroService sets the micro.Service used internally.
|
||||
func MicroService(s micro.Service) Option {
|
||||
return func(o *Options) {
|
||||
o.Service = s
|
||||
@@ -224,7 +224,7 @@ func AfterStop(fn func() error) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// Secure Use secure communication. If TLSConfig is not specified we use InsecureSkipVerify and generate a self signed cert
|
||||
// Secure Use secure communication. If TLSConfig is not specified we use InsecureSkipVerify and generate a self signed cert.
|
||||
func Secure(b bool) Option {
|
||||
return func(o *Options) {
|
||||
o.Secure = b
|
||||
@@ -238,14 +238,14 @@ func TLSConfig(t *tls.Config) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// StaticDir sets the static file directory. This defaults to ./html
|
||||
// StaticDir sets the static file directory. This defaults to ./html.
|
||||
func StaticDir(d string) Option {
|
||||
return func(o *Options) {
|
||||
o.StaticDir = d
|
||||
}
|
||||
}
|
||||
|
||||
// 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
|
||||
@@ -261,7 +261,7 @@ func HandleSignal(b bool) Option {
|
||||
}
|
||||
}
|
||||
|
||||
// Logger sets the underline logger
|
||||
// Logger sets the underline logger.
|
||||
func Logger(l logger.Logger) Option {
|
||||
return func(o *Options) {
|
||||
o.Logger = l
|
||||
|
||||
Reference in New Issue
Block a user