fix: comments

Signed-off-by: Manik Rana <manikrana54@gmail.com>
This commit is contained in:
Manik Rana 2024-07-09 21:37:39 +05:30
parent 8ea8352fdc
commit 9c4bc807be
2 changed files with 9 additions and 6 deletions

View file

@ -31,16 +31,19 @@ func (ls Labels) Len() int { return len(ls) }
func (ls Labels) Swap(i, j int) { ls[i], ls[j] = ls[j], ls[i] }
func (ls Labels) Less(i, j int) bool { return ls[i].Name < ls[j].Name }
func (l Labels) ExtractNames() []string {
names := make([]string, len(l))
for i, label := range l {
// ExtractNames returns an array of all Name in ls.
func (ls Labels) ExtractNames() []string {
names := make([]string, len(ls))
for i, label := range ls {
names[i] = label.Name
}
return names
}
func (l Labels) Contains(name string) bool {
for _, label := range l {
// Contains returns true if the label set contains the provided label name.
func (ls Labels) Contains(name string) bool {
for _, label := range ls {
if label.Name == name {
return true
}

View file

@ -282,7 +282,7 @@ loop:
}
// We need this because we want offsets of the original parser unchanged when
// we're working with a new parser in CreatedTimeStamp()
// we're working with a new parser in CreatedTimeStamp().
func deepCopyParser(p *OpenMetricsParser) OpenMetricsParser {
newB := make([]byte, len(p.l.b))
copy(newB, p.l.b)