chore: typos across source code comments (#10361)

This commit is contained in:
Howie 2022-01-05 23:20:10 +08:00 committed by GitHub
parent 1b7e8c90e9
commit 381dc22723
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 16 additions and 16 deletions

View File

@ -41,7 +41,7 @@ type Accumulator interface {
// AddMetric adds an metric to the accumulator. // AddMetric adds an metric to the accumulator.
AddMetric(Metric) 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 // added to the accumulator will have their timestamp rounded to the
// nearest multiple of precision. // nearest multiple of precision.
SetPrecision(precision time.Duration) SetPrecision(precision time.Duration)

View File

@ -14,7 +14,7 @@ func Contains(choice string, choices []string) bool {
return false 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. // the available choices.
func Check(choice string, available []string) error { func Check(choice string, available []string) error {
if !Contains(choice, available) { if !Contains(choice, available) {
@ -23,7 +23,7 @@ func Check(choice string, available []string) error {
return nil 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. // available.
func CheckSlice(choices, available []string) error { func CheckSlice(choices, available []string) error {
for _, choice := range choices { for _, choice := range choices {

View File

@ -46,7 +46,7 @@ func Compile(path string) (*GlobPath, error) {
// All returned path will have the host platform separator. // All returned path will have the host platform separator.
func (g *GlobPath) Match() []string { func (g *GlobPath) Match() []string {
// This string replacement is for backwards compatibility support // 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, "**/**", "**")
g.path = strings.ReplaceAll(g.path, "**", "**/**") g.path = strings.ReplaceAll(g.path, "**", "**/**")

View File

@ -185,7 +185,7 @@ func AlignTime(tm time.Time, interval time.Duration) time.Time {
return truncated.Add(interval) 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 // and returns the exit status and true
// if error is not exit status, will return 0 and false // if error is not exit status, will return 0 and false
func ExitStatus(err error) (int, bool) { func ExitStatus(err error) (int, bool) {

View File

@ -18,7 +18,7 @@ func WithTracking(metric telegraf.Metric, fn NotifyFunc) (telegraf.Metric, teleg
return newTrackingMetric(metric, fn) 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. // function to be called when processing is complete.
func WithGroupTracking(metric []telegraf.Metric, fn NotifyFunc) ([]telegraf.Metric, telegraf.TrackingID) { func WithGroupTracking(metric []telegraf.Metric, fn NotifyFunc) ([]telegraf.Metric, telegraf.TrackingID) {
return newTrackingMetricGroup(metric, fn) return newTrackingMetricGroup(metric, fn)

View File

@ -229,7 +229,7 @@ func (b *Buffer) next(index int) int {
return index 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 { func (b *Buffer) nextby(index, count int) int {
index += count index += count
index %= b.cap index %= b.cap

View File

@ -4,7 +4,7 @@ import (
"github.com/influxdata/telegraf" "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. // settings.
func makemetric( func makemetric(
metric telegraf.Metric, metric telegraf.Metric,

View File

@ -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) 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 } 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 { type ProcessorConfig struct {
Name string Name string
Alias string Alias string

View File

@ -23,7 +23,7 @@ type Decoder struct {
transform.Transformer transform.Transformer
// This forces external creators of Decoders to use names in struct // 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. // code.
_ struct{} _ struct{}
} }

View File

@ -994,7 +994,7 @@ func (m *Mysql) GatherProcessListStatuses(db *sql.DB, serv string, acc telegraf.
return nil 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 // and its state with its running count
func (m *Mysql) GatherUserStatisticsStatuses(db *sql.DB, serv string, acc telegraf.Accumulator) error { func (m *Mysql) GatherUserStatisticsStatuses(db *sql.DB, serv string, acc telegraf.Accumulator) error {
// run query // run query

View File

@ -34,7 +34,7 @@ type ParserInput interface {
// ParserFuncInput is an interface for input plugins that are able to parse // ParserFuncInput is an interface for input plugins that are able to parse
// arbitrary data formats. // arbitrary data formats.
type ParserFuncInput interface { type ParserFuncInput interface {
// GetParser returns a new parser. // SetParserFunc returns a new parser.
SetParserFunc(fn ParserFunc) SetParserFunc(fn ParserFunc)
} }
@ -65,7 +65,7 @@ type Parser interface {
// Config is a struct that covers the data types needed for all parser types, // Config is a struct that covers the data types needed for all parser types,
// and can be used to instantiate _any_ of the parsers. // and can be used to instantiate _any_ of the parsers.
type Config struct { 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"` DataFormat string `toml:"data_format"`
// Separator only applied to Graphite data. // Separator only applied to Graphite data.

View File

@ -13,10 +13,10 @@ type Serializer struct {
TimestampFormat string TimestampFormat string
} }
func NewSerializer(timestampUnits time.Duration, timestampformat string) (*Serializer, error) { func NewSerializer(timestampUnits time.Duration, timestampFormat string) (*Serializer, error) {
s := &Serializer{ s := &Serializer{
TimestampUnits: truncateDuration(timestampUnits), TimestampUnits: truncateDuration(timestampUnits),
TimestampFormat: timestampformat, TimestampFormat: timestampFormat,
} }
return s, nil return s, nil
} }

View File

@ -47,7 +47,7 @@ type Serializer interface {
// Config is a struct that covers the data types needed for all serializer types, // Config is a struct that covers the data types needed for all serializer types,
// and can be used to instantiate _any_ of the serializers. // and can be used to instantiate _any_ of the serializers.
type Config struct { 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"` DataFormat string `toml:"data_format"`
// Carbon2 metric format. // Carbon2 metric format.