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(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)

View File

@ -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 {

View File

@ -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, "**", "**/**")

View File

@ -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) {

View File

@ -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)

View File

@ -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

View File

@ -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,

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) 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

View File

@ -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{}
}

View File

@ -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

View File

@ -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.

View File

@ -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
}

View File

@ -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.