Skip to content

Commit 62eaec4

Browse files
committed
make statis strings const
Signed-off-by: Walther Lee <[email protected]>
1 parent bb390a8 commit 62eaec4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

pkg/store/proxy.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -597,9 +597,9 @@ func storeMatches(ctx context.Context, debugLogging bool, s Client, mint, maxt i
597597

598598
storeMinTime, storeMaxTime := s.TimeRange()
599599
if mint > storeMaxTime || maxt < storeMinTime {
600-
s := "does not have data within this time period"
600+
const s string = "does not have data within this time period"
601601
if debugLogging {
602-
s = fmt.Sprintf("%s: [%v,%v]. Store time ranges: [%v,%v]", s, mint, maxt, storeMinTime, storeMaxTime)
602+
return false, fmt.Sprintf("%s: [%v,%v]. Store time ranges: [%v,%v]", s, mint, maxt, storeMinTime, storeMaxTime)
603603
}
604604
return false, s
605605
}
@@ -610,9 +610,9 @@ func storeMatches(ctx context.Context, debugLogging bool, s Client, mint, maxt i
610610

611611
extLset := s.LabelSets()
612612
if !LabelSetsMatch(matchers, extLset...) {
613-
s := "external labels does not match request label matchers"
613+
const s string = "external labels does not match request label matchers"
614614
if debugLogging {
615-
s = fmt.Sprintf("external labels %v does not match request label matchers: %v", extLset, matchers)
615+
return false, fmt.Sprintf("external labels %v does not match request label matchers: %v", extLset, matchers)
616616
}
617617
return false, s
618618
}
@@ -635,9 +635,9 @@ func storeMatchDebugMetadata(s Client, debugLogging bool, storeDebugMatchers [][
635635
match = match || LabelSetsMatch(sm, labels.FromStrings("__address__", addr))
636636
}
637637
if !match {
638-
s := "__address__ does not match debug store metadata matchers"
638+
const s string = "__address__ does not match debug store metadata matchers"
639639
if debugLogging {
640-
s = fmt.Sprintf("__address__ %v does not match debug store metadata matchers: %v", addr, storeDebugMatchers)
640+
return false, fmt.Sprintf("__address__ %v does not match debug store metadata matchers: %v", addr, storeDebugMatchers)
641641
}
642642
return false, s
643643
}

0 commit comments

Comments
 (0)