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:
@@ -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)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user