From 381dc2272390cd9de1ce2b047a953f8337b55647 Mon Sep 17 00:00:00 2001 From: Howie Date: Wed, 5 Jan 2022 23:20:10 +0800 Subject: [PATCH] chore: typos across source code comments (#10361) --- accumulator.go | 2 +- internal/choice/choice.go | 4 ++-- internal/globpath/globpath.go | 2 +- internal/internal.go | 2 +- metric/tracking.go | 2 +- models/buffer.go | 2 +- models/makemetric.go | 2 +- models/running_processor.go | 2 +- plugins/common/encoding/decoder_reader.go | 2 +- plugins/inputs/mysql/mysql.go | 2 +- plugins/parsers/registry.go | 4 ++-- plugins/serializers/json/json.go | 4 ++-- plugins/serializers/registry.go | 2 +- 13 files changed, 16 insertions(+), 16 deletions(-) diff --git a/accumulator.go b/accumulator.go index 1ea5737a8..53ce0642b 100644 --- a/accumulator.go +++ b/accumulator.go @@ -41,7 +41,7 @@ type Accumulator interface { // AddMetric adds an metric to the accumulator. AddMetric(Metric) - // SetPrecision sets the timestamp rounding precision. All metrics addeds + // SetPrecision sets the timestamp rounding precision. All metrics // added to the accumulator will have their timestamp rounded to the // nearest multiple of precision. SetPrecision(precision time.Duration) diff --git a/internal/choice/choice.go b/internal/choice/choice.go index 33c26096d..5c178fa73 100644 --- a/internal/choice/choice.go +++ b/internal/choice/choice.go @@ -14,7 +14,7 @@ func Contains(choice string, choices []string) bool { return false } -// CheckSContains returns an error if a choice is not one of +// Check returns an error if a choice is not one of // the available choices. func Check(choice string, available []string) error { if !Contains(choice, available) { @@ -23,7 +23,7 @@ func Check(choice string, available []string) error { return nil } -// CheckSliceContains returns an error if the choices is not a subset of +// CheckSlice returns an error if the choices is not a subset of // available. func CheckSlice(choices, available []string) error { for _, choice := range choices { diff --git a/internal/globpath/globpath.go b/internal/globpath/globpath.go index fb49c232e..98b286d79 100644 --- a/internal/globpath/globpath.go +++ b/internal/globpath/globpath.go @@ -46,7 +46,7 @@ func Compile(path string) (*GlobPath, error) { // All returned path will have the host platform separator. func (g *GlobPath) Match() []string { // This string replacement is for backwards compatibility support - // The original implemention allowed **.txt but the double star package requires **/**.txt + // The original implementation allowed **.txt but the double star package requires **/**.txt g.path = strings.ReplaceAll(g.path, "**/**", "**") g.path = strings.ReplaceAll(g.path, "**", "**/**") diff --git a/internal/internal.go b/internal/internal.go index 49f92bfcd..0c6cba5af 100644 --- a/internal/internal.go +++ b/internal/internal.go @@ -185,7 +185,7 @@ func AlignTime(tm time.Time, interval time.Duration) time.Time { return truncated.Add(interval) } -// Exit status takes the error from exec.Command +// ExitStatus takes the error from exec.Command // and returns the exit status and true // if error is not exit status, will return 0 and false func ExitStatus(err error) (int, bool) { diff --git a/metric/tracking.go b/metric/tracking.go index e0bf5ff8e..2f46b4b05 100644 --- a/metric/tracking.go +++ b/metric/tracking.go @@ -18,7 +18,7 @@ func WithTracking(metric telegraf.Metric, fn NotifyFunc) (telegraf.Metric, teleg return newTrackingMetric(metric, fn) } -// WithBatchTracking adds tracking to the metrics and registers the notify +// WithGroupTracking adds tracking to the metrics and registers the notify // function to be called when processing is complete. func WithGroupTracking(metric []telegraf.Metric, fn NotifyFunc) ([]telegraf.Metric, telegraf.TrackingID) { return newTrackingMetricGroup(metric, fn) diff --git a/models/buffer.go b/models/buffer.go index 5f721dc98..1e6ef10fd 100644 --- a/models/buffer.go +++ b/models/buffer.go @@ -229,7 +229,7 @@ func (b *Buffer) next(index int) int { return index } -// next returns the index that is count newer with wrapping. +// nextby returns the index that is count newer with wrapping. func (b *Buffer) nextby(index, count int) int { index += count index %= b.cap diff --git a/models/makemetric.go b/models/makemetric.go index 29ef5f452..b0ce905c4 100644 --- a/models/makemetric.go +++ b/models/makemetric.go @@ -4,7 +4,7 @@ import ( "github.com/influxdata/telegraf" ) -// Makemetric applies new metric plugin and agent measurement and tag +// makemetric applies new metric plugin and agent measurement and tag // settings. func makemetric( metric telegraf.Metric, diff --git a/models/running_processor.go b/models/running_processor.go index 5201fb27f..0e4385741 100644 --- a/models/running_processor.go +++ b/models/running_processor.go @@ -20,7 +20,7 @@ func (rp RunningProcessors) Len() int { return len(rp) } func (rp RunningProcessors) Swap(i, j int) { rp[i], rp[j] = rp[j], rp[i] } func (rp RunningProcessors) Less(i, j int) bool { return rp[i].Config.Order < rp[j].Config.Order } -// FilterConfig containing a name and filter +// ProcessorConfig containing a name and filter type ProcessorConfig struct { Name string Alias string diff --git a/plugins/common/encoding/decoder_reader.go b/plugins/common/encoding/decoder_reader.go index 79bf11ed5..586865cf7 100644 --- a/plugins/common/encoding/decoder_reader.go +++ b/plugins/common/encoding/decoder_reader.go @@ -23,7 +23,7 @@ type Decoder struct { transform.Transformer // This forces external creators of Decoders to use names in struct - // initializers, allowing for future extendibility without having to break + // initializers, allowing for future extensibility without having to break // code. _ struct{} } diff --git a/plugins/inputs/mysql/mysql.go b/plugins/inputs/mysql/mysql.go index 3fbd4654e..7841b4b5b 100644 --- a/plugins/inputs/mysql/mysql.go +++ b/plugins/inputs/mysql/mysql.go @@ -994,7 +994,7 @@ func (m *Mysql) GatherProcessListStatuses(db *sql.DB, serv string, acc telegraf. return nil } -// GatherUserStatistics can be used to collect metrics on each running command +// GatherUserStatisticsStatuses can be used to collect metrics on each running command // and its state with its running count func (m *Mysql) GatherUserStatisticsStatuses(db *sql.DB, serv string, acc telegraf.Accumulator) error { // run query diff --git a/plugins/parsers/registry.go b/plugins/parsers/registry.go index 208dd7ccc..82df5ccab 100644 --- a/plugins/parsers/registry.go +++ b/plugins/parsers/registry.go @@ -34,7 +34,7 @@ type ParserInput interface { // ParserFuncInput is an interface for input plugins that are able to parse // arbitrary data formats. type ParserFuncInput interface { - // GetParser returns a new parser. + // SetParserFunc returns a new parser. SetParserFunc(fn ParserFunc) } @@ -65,7 +65,7 @@ type Parser interface { // Config is a struct that covers the data types needed for all parser types, // and can be used to instantiate _any_ of the parsers. type Config struct { - // Dataformat can be one of: json, influx, graphite, value, nagios + // DataFormat can be one of: json, influx, graphite, value, nagios DataFormat string `toml:"data_format"` // Separator only applied to Graphite data. diff --git a/plugins/serializers/json/json.go b/plugins/serializers/json/json.go index a2f32f37a..a000a1c62 100644 --- a/plugins/serializers/json/json.go +++ b/plugins/serializers/json/json.go @@ -13,10 +13,10 @@ type Serializer struct { TimestampFormat string } -func NewSerializer(timestampUnits time.Duration, timestampformat string) (*Serializer, error) { +func NewSerializer(timestampUnits time.Duration, timestampFormat string) (*Serializer, error) { s := &Serializer{ TimestampUnits: truncateDuration(timestampUnits), - TimestampFormat: timestampformat, + TimestampFormat: timestampFormat, } return s, nil } diff --git a/plugins/serializers/registry.go b/plugins/serializers/registry.go index 5030531bf..97938c8a5 100644 --- a/plugins/serializers/registry.go +++ b/plugins/serializers/registry.go @@ -47,7 +47,7 @@ type Serializer interface { // Config is a struct that covers the data types needed for all serializer types, // and can be used to instantiate _any_ of the serializers. type Config struct { - // Dataformat can be one of the serializer types listed in NewSerializer. + // DataFormat can be one of the serializer types listed in NewSerializer. DataFormat string `toml:"data_format"` // Carbon2 metric format.