From 3202b403d87fc10aaf62601c186205c3ab612319 Mon Sep 17 00:00:00 2001 From: Anderson Queiroz <contato@andersonq.eti.br> Date: Tue, 25 Jan 2022 11:06:22 +0100 Subject: [PATCH] [Elastic Agent] Fix some typos (#29890) --- dev-tools/mage/crossbuild.go | 4 ++-- libbeat/common/backoff/equal_jitter.go | 4 ++-- libbeat/logp/configure/logging.go | 2 +- libbeat/logp/core.go | 2 +- x-pack/elastic-agent/magefile.go | 2 +- .../pkg/agent/application/gateway/fleet/fleet_gateway.go | 3 ++- .../elastic-agent/pkg/agent/application/pipeline/pipeline.go | 2 +- x-pack/elastic-agent/pkg/agent/application/reexec/manager.go | 2 +- x-pack/elastic-agent/pkg/core/server/server.go | 2 +- x-pack/elastic-agent/pkg/core/status/reporter.go | 2 +- 10 files changed, 13 insertions(+), 12 deletions(-) diff --git a/dev-tools/mage/crossbuild.go b/dev-tools/mage/crossbuild.go index 9f56fd125c3e..ee209bd688c2 100644 --- a/dev-tools/mage/crossbuild.go +++ b/dev-tools/mage/crossbuild.go @@ -43,8 +43,8 @@ const defaultCrossBuildTarget = "golangCrossBuild" // See NewPlatformList for details about platform filtering expressions. var Platforms = BuildPlatforms.Defaults() -// Types is the list of package types -var SelectedPackageTypes []PackageType +// SelectedPackageTypes is the list of package types +var SelectedPackageTypes []PackageType = []PackageType{TarGz} func init() { // Allow overriding via PLATFORMS. diff --git a/libbeat/common/backoff/equal_jitter.go b/libbeat/common/backoff/equal_jitter.go index ff5c86f156fb..d5b5c7d250c8 100644 --- a/libbeat/common/backoff/equal_jitter.go +++ b/libbeat/common/backoff/equal_jitter.go @@ -47,11 +47,11 @@ func NewEqualJitterBackoff(done <-chan struct{}, init, max time.Duration) Backof // Reset resets the duration of the backoff. func (b *EqualJitterBackoff) Reset() { - // Allow to sleep at least the init period on the first wait. + // Allow sleeping at least the init period on the first wait. b.duration = b.init * 2 } -// Wait block until either the timer is completed or channel is done. +// Wait blocks until either the timer is completed or channel is done. func (b *EqualJitterBackoff) Wait() bool { // Make sure we have always some minimal back off and jitter. temp := int64(b.duration / 2) diff --git a/libbeat/logp/configure/logging.go b/libbeat/logp/configure/logging.go index 43a32dd7f2fc..9a041bc25599 100644 --- a/libbeat/logp/configure/logging.go +++ b/libbeat/logp/configure/logging.go @@ -60,7 +60,7 @@ func Logging(beatName string, cfg *common.Config) error { return logp.Configure(config) } -// Logging builds a logp.Config based on the given common.Config and the specified +// LoggingWithOutputs builds a logp.Config based on the given common.Config and the specified // CLI flags along with the given outputs. func LoggingWithOutputs(beatName string, cfg *common.Config, outputs ...zapcore.Core) error { config := logp.DefaultConfig(environment) diff --git a/libbeat/logp/core.go b/libbeat/logp/core.go index 552c81e92015..262515ac8d2e 100644 --- a/libbeat/logp/core.go +++ b/libbeat/logp/core.go @@ -67,7 +67,7 @@ func Configure(cfg Config) error { return ConfigureWithOutputs(cfg) } -// XXX: ConfigureWithOutputs is used by elastic-agent only (See file: x-pack/elastic-agent/pkg/core/logger/logger.go). +// ConfigureWithOutputs XXX: is used by elastic-agent only (See file: x-pack/elastic-agent/pkg/core/logger/logger.go). // The agent requires that the output specified in the config object is configured and merged with the // logging outputs given. func ConfigureWithOutputs(cfg Config, outputs ...zapcore.Core) error { diff --git a/x-pack/elastic-agent/magefile.go b/x-pack/elastic-agent/magefile.go index a04d3c974bfe..ed84c8ca0734 100644 --- a/x-pack/elastic-agent/magefile.go +++ b/x-pack/elastic-agent/magefile.go @@ -508,7 +508,7 @@ func runAgent(env map[string]string) error { return err } - // docker does not exists for this commit, build it + // docker does not exist for this commit, build it if !strings.Contains(dockerImageOut, tag) { // produce docker package packageAgent([]string{ diff --git a/x-pack/elastic-agent/pkg/agent/application/gateway/fleet/fleet_gateway.go b/x-pack/elastic-agent/pkg/agent/application/gateway/fleet/fleet_gateway.go index ee16f4b9a9df..fd835ee95f48 100644 --- a/x-pack/elastic-agent/pkg/agent/application/gateway/fleet/fleet_gateway.go +++ b/x-pack/elastic-agent/pkg/agent/application/gateway/fleet/fleet_gateway.go @@ -127,7 +127,8 @@ func newFleetGatewayWithScheduler( stateStore stateStore, ) (gateway.FleetGateway, error) { - // Backoff implementation doesn't support the using context as the shutdown mechanism. + // Backoff implementation doesn't support the use of a context [cancellation] + // as the shutdown mechanism. // So we keep a done channel that will be closed when the current context is shutdown. done := make(chan struct{}) diff --git a/x-pack/elastic-agent/pkg/agent/application/pipeline/pipeline.go b/x-pack/elastic-agent/pkg/agent/application/pipeline/pipeline.go index c8cac5b32162..f2f02efb2585 100644 --- a/x-pack/elastic-agent/pkg/agent/application/pipeline/pipeline.go +++ b/x-pack/elastic-agent/pkg/agent/application/pipeline/pipeline.go @@ -29,7 +29,7 @@ var DefaultRK = "default" // RoutingKey is used for routing as pipeline id. type RoutingKey = string -// Router is an interace routes programs to correspongind stream +// Router is an interface routing programs to the corresponding stream. type Router interface { Routes() *sorted.Set Route(id string, grpProg map[RoutingKey][]program.Program) error diff --git a/x-pack/elastic-agent/pkg/agent/application/reexec/manager.go b/x-pack/elastic-agent/pkg/agent/application/reexec/manager.go index 5ccc870d948f..d251926d3576 100644 --- a/x-pack/elastic-agent/pkg/agent/application/reexec/manager.go +++ b/x-pack/elastic-agent/pkg/agent/application/reexec/manager.go @@ -54,7 +54,7 @@ func (m *manager) ReExec(shutdownCallback ShutdownCallbackFn, argOverrides ...st if shutdownCallback != nil { if err := shutdownCallback(); err != nil { // panic; because there is no going back, everything is shutdown - panic(errors.New(errors.TypeUnexpected, err, "failure occured during shutdown cleanup")) + panic(errors.New(errors.TypeUnexpected, err, "failure occurred during shutdown cleanup")) } } diff --git a/x-pack/elastic-agent/pkg/core/server/server.go b/x-pack/elastic-agent/pkg/core/server/server.go index 390283b4e152..f584e70bad25 100644 --- a/x-pack/elastic-agent/pkg/core/server/server.go +++ b/x-pack/elastic-agent/pkg/core/server/server.go @@ -581,7 +581,7 @@ func (as *ApplicationState) Stop(timeout time.Duration) error { doneChan := as.checkinDone as.checkinLock.RUnlock() if (wasConn && doneChan == nil) || (!wasConn && s == proto.StateObserved_STOPPING && doneChan == nil) { - // either occurred + // either occurred: // * client was connected then disconnected on stop // * client was not connected; connected; received stopping; then disconnected as.Destroy() diff --git a/x-pack/elastic-agent/pkg/core/status/reporter.go b/x-pack/elastic-agent/pkg/core/status/reporter.go index 3add6b188c87..2e34bb15cdc1 100644 --- a/x-pack/elastic-agent/pkg/core/status/reporter.go +++ b/x-pack/elastic-agent/pkg/core/status/reporter.go @@ -279,7 +279,7 @@ func (r *reporter) Update(s state.Status, message string, payload map[string]int } } -// Unregister unregister status from reporter. Reporter will no longer be taken into consideration +// Unregister unregisters status from reporter. Reporter will no longer be taken into consideration // for overall status computation. func (r *reporter) Unregister() { r.mx.Lock()