1
0
mirror of https://github.com/go-micro/go-micro.git synced 2025-12-05 21:56:14 +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

@@ -10,7 +10,7 @@ import (
type Option func(o *Options)
// Options configure runtime
// Options configure runtime.
type Options struct {
// Scheduler for updates
Scheduler Scheduler
@@ -38,42 +38,42 @@ func NewOptions(opts ...Option) *Options {
return options
}
// WithSource sets the base image / repository
// WithSource sets the base image / repository.
func WithSource(src string) Option {
return func(o *Options) {
o.Source = src
}
}
// WithScheduler specifies a scheduler for updates
// WithScheduler specifies a scheduler for updates.
func WithScheduler(n Scheduler) Option {
return func(o *Options) {
o.Scheduler = n
}
}
// WithType sets the service type to manage
// WithType sets the service type to manage.
func WithType(t string) Option {
return func(o *Options) {
o.Type = t
}
}
// WithImage sets the image to use
// WithImage sets the image to use.
func WithImage(t string) Option {
return func(o *Options) {
o.Image = t
}
}
// WithClient sets the client to use
// WithClient sets the client to use.
func WithClient(c client.Client) Option {
return func(o *Options) {
o.Client = c
}
}
// WithLogger sets the underline logger
// WithLogger sets the underline logger.
func WithLogger(l logger.Logger) Option {
return func(o *Options) {
o.Logger = l
@@ -84,7 +84,7 @@ type CreateOption func(o *CreateOptions)
type ReadOption func(o *ReadOptions)
// CreateOptions configure runtime services
// CreateOptions configure runtime services.
type CreateOptions struct {
// Command to execut
Command []string
@@ -106,7 +106,7 @@ type CreateOptions struct {
Context context.Context
}
// ReadOptions queries runtime services
// ReadOptions queries runtime services.
type ReadOptions struct {
// Service name
Service string
@@ -120,35 +120,35 @@ type ReadOptions struct {
Context context.Context
}
// CreateType sets the type of service to create
// CreateType sets the type of service to create.
func CreateType(t string) CreateOption {
return func(o *CreateOptions) {
o.Type = t
}
}
// CreateImage sets the image to use
// CreateImage sets the image to use.
func CreateImage(img string) CreateOption {
return func(o *CreateOptions) {
o.Image = img
}
}
// CreateNamespace sets the namespace
// CreateNamespace sets the namespace.
func CreateNamespace(ns string) CreateOption {
return func(o *CreateOptions) {
o.Namespace = ns
}
}
// CreateContext sets the context
// CreateContext sets the context.
func CreateContext(ctx context.Context) CreateOption {
return func(o *CreateOptions) {
o.Context = ctx
}
}
// WithCommand specifies the command to execute
// WithCommand specifies the command to execute.
func WithCommand(cmd ...string) CreateOption {
return func(o *CreateOptions) {
// set command
@@ -156,7 +156,7 @@ func WithCommand(cmd ...string) CreateOption {
}
}
// WithArgs specifies the command to execute
// WithArgs specifies the command to execute.
func WithArgs(args ...string) CreateOption {
return func(o *CreateOptions) {
// set command
@@ -164,56 +164,55 @@ func WithArgs(args ...string) CreateOption {
}
}
// WithRetries sets the max retries attemps
func WithRetries(retries int) CreateOption {
return func(o *CreateOptions) {
o.Retries = retries
}
}
// WithEnv sets the created service environment
// WithEnv sets the created service environment.
func WithEnv(env []string) CreateOption {
return func(o *CreateOptions) {
o.Env = env
}
}
// WithOutput sets the arg output
// WithOutput sets the arg output.
func WithOutput(out io.Writer) CreateOption {
return func(o *CreateOptions) {
o.Output = out
}
}
// ReadService returns services with the given name
// ReadService returns services with the given name.
func ReadService(service string) ReadOption {
return func(o *ReadOptions) {
o.Service = service
}
}
// ReadVersion confifgures service version
// ReadVersion confifgures service version.
func ReadVersion(version string) ReadOption {
return func(o *ReadOptions) {
o.Version = version
}
}
// ReadType returns services of the given type
// ReadType returns services of the given type.
func ReadType(t string) ReadOption {
return func(o *ReadOptions) {
o.Type = t
}
}
// ReadNamespace sets the namespace
// ReadNamespace sets the namespace.
func ReadNamespace(ns string) ReadOption {
return func(o *ReadOptions) {
o.Namespace = ns
}
}
// ReadContext sets the context
// ReadContext sets the context.
func ReadContext(ctx context.Context) ReadOption {
return func(o *ReadOptions) {
o.Context = ctx
@@ -229,14 +228,14 @@ type UpdateOptions struct {
Context context.Context
}
// UpdateNamespace sets the namespace
// UpdateNamespace sets the namespace.
func UpdateNamespace(ns string) UpdateOption {
return func(o *UpdateOptions) {
o.Namespace = ns
}
}
// UpdateContext sets the context
// UpdateContext sets the context.
func UpdateContext(ctx context.Context) UpdateOption {
return func(o *UpdateOptions) {
o.Context = ctx
@@ -252,24 +251,24 @@ type DeleteOptions struct {
Context context.Context
}
// DeleteNamespace sets the namespace
// DeleteNamespace sets the namespace.
func DeleteNamespace(ns string) DeleteOption {
return func(o *DeleteOptions) {
o.Namespace = ns
}
}
// DeleteContext sets the context
// DeleteContext sets the context.
func DeleteContext(ctx context.Context) DeleteOption {
return func(o *DeleteOptions) {
o.Context = ctx
}
}
// LogsOption configures runtime logging
// LogsOption configures runtime logging.
type LogsOption func(o *LogsOptions)
// LogsOptions configure runtime logging
// LogsOptions configure runtime logging.
type LogsOptions struct {
// How many existing lines to show
Count int64
@@ -281,28 +280,28 @@ type LogsOptions struct {
Context context.Context
}
// LogsExistingCount confiures how many existing lines to show
// LogsExistingCount confiures how many existing lines to show.
func LogsCount(count int64) LogsOption {
return func(l *LogsOptions) {
l.Count = count
}
}
// LogsStream configures whether to stream new lines
// LogsStream configures whether to stream new lines.
func LogsStream(stream bool) LogsOption {
return func(l *LogsOptions) {
l.Stream = stream
}
}
// LogsNamespace sets the namespace
// LogsNamespace sets the namespace.
func LogsNamespace(ns string) LogsOption {
return func(o *LogsOptions) {
o.Namespace = ns
}
}
// LogsContext sets the context
// LogsContext sets the context.
func LogsContext(ctx context.Context) LogsOption {
return func(o *LogsOptions) {
o.Context = ctx