Chore: Avoid unnecessary byte/string conversions (#69001)

Avoid unnecessary byte/string conversion

We can use alternative functions/methods to avoid unnecessary
byte/string conversion calls.

Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
This commit is contained in:
Eng Zer Jun
2023-05-26 10:08:50 +00:00
committed by GitHub
parent 515270f5fd
commit 7f7b03d794
5 changed files with 13 additions and 13 deletions
+2 -2
View File
@@ -60,7 +60,7 @@ func (query *Query) renderTags() []string {
// If the operator is missing we fall back to sensible defaults
if tag.Operator == "" {
if regexpOperatorPattern.Match([]byte(tag.Value)) {
if regexpOperatorPattern.MatchString(tag.Value) {
tag.Operator = "=~"
} else {
tag.Operator = "="
@@ -124,7 +124,7 @@ func (query *Query) renderMeasurement() string {
measurement := query.Measurement
if !regexpMeasurementPattern.Match([]byte(measurement)) {
if !regexpMeasurementPattern.MatchString(measurement) {
measurement = fmt.Sprintf(`"%s"`, measurement)
}