From 99e4a4fbae5938f4fd31b8bc90755826f650d9da Mon Sep 17 00:00:00 2001 From: beorn7 Date: Wed, 13 Jan 2021 18:49:06 +0100 Subject: [PATCH] Address code review comments Signed-off-by: beorn7 --- pkg/labels/matcher.go | 2 +- pkg/labels/parse.go | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/labels/matcher.go b/pkg/labels/matcher.go index 69029f55..3628d43b 100644 --- a/pkg/labels/matcher.go +++ b/pkg/labels/matcher.go @@ -90,7 +90,7 @@ func (m *Matcher) Matches(s string) bool { // openMetricsEscape is similar to the usual string escaping, but more // restricted. It merely replaces a new-line character with '\n', a double-quote -// character with '\"', and a backslack with '\\', which is the escaping used by +// character with '\"', and a backslash with '\\', which is the escaping used by // OpenMetrics. func openMetricsEscape(s string) string { r := strings.NewReplacer( diff --git a/pkg/labels/parse.go b/pkg/labels/parse.go index 3fd213f0..907056fe 100644 --- a/pkg/labels/parse.go +++ b/pkg/labels/parse.go @@ -38,7 +38,7 @@ var ( // ParseMatchers parses a comma-separated list of Matchers. A leading '{' and/or // a trailing '}' is optional and will be trimmed before further // parsing. Individual Matchers are separated by commas outside of quoted parts -// of the input string. Those commas may be sorrounded by whitespace. Parts of the +// of the input string. Those commas may be surrounded by whitespace. Parts of the // string inside unescaped double quotes ('"…"') are considered quoted (and // commas don't act as separators there). If double quotes are escaped with a // single backslash ('\"'), they are ignored for the purpose of identifying @@ -49,10 +49,11 @@ var ( // Examples for valid input strings: // {foo = "bar", dings != "bums", } // foo=bar,dings!=bums +// foo=bar, dings!=bums // {quote="She said: \"Hi, ladies! That's gender-neutral…\""} // statuscode=~"5.." // -// See ParseMatcher for details how an individual Matcher is parsed. +// See ParseMatcher for details on how an individual Matcher is parsed. func ParseMatchers(s string) ([]*Matcher, error) { matchers := []*Matcher{} s = strings.TrimPrefix(s, "{")