@@ -11,6 +11,7 @@ import (
1111 "os/exec"
1212 "path/filepath"
1313 "regexp"
14+ "slices"
1415 "strconv"
1516 "strings"
1617 "sync"
@@ -48,7 +49,7 @@ func main() {
4849 http .HandleFunc ("/health-check/" , func (w http.ResponseWriter , r * http.Request ) {
4950 locationLogMutex .Lock ()
5051 for k , v := range locationTracker {
51- _ , _ = w . Write ([] byte ( fmt .Sprintf ( "%s:%d\n " , k , v )) )
52+ _ , _ = fmt .Fprintf ( w , "%s:%d\n " , k , v )
5253 }
5354 locationLogMutex .Unlock ()
5455 })
@@ -115,21 +116,15 @@ func filterBad(loc location) bool {
115116 }
116117 }
117118
118- if count >= 2 {
119- return true
120- }
121-
122- return false
119+ return count >= 2
123120}
124121
125122func appendLocationLog (log string ) {
126123 locationLogMutex .Lock ()
127124 defer locationLogMutex .Unlock ()
128125
129- for _ , l := range locationLog {
130- if l == log {
131- return
132- }
126+ if slices .Contains (locationLog , log ) {
127+ return
133128 }
134129 locationLog = append (locationLog , log )
135130 locationTracker [log ] = locationTracker [log ] + 1
@@ -400,10 +395,10 @@ func processPath(s string) string {
400395 sp = append (sp , cleanString (s ))
401396 }
402397
403- filename := strings .Replace (sp [2 ], ".com" , "" , - 1 )
404- filename = strings .Replace (filename , ".org" , "" , - 1 )
398+ filename := strings .ReplaceAll (sp [2 ], ".com" , "" )
399+ filename = strings .ReplaceAll (filename , ".org" , "" )
405400 filename += "." + sp [3 ]
406- filename += "." + strings .Replace (sp [4 ], ".git" , "" , - 1 ) + ".json"
401+ filename += "." + strings .ReplaceAll (sp [4 ], ".git" , "" ) + ".json"
407402
408403 return filename
409404}
0 commit comments