add shield item of config in .gitignore

This commit is contained in:
douxu 2025-10-16 17:45:10 +08:00
parent f0a66263a3
commit 68a800ce63
2 changed files with 10 additions and 9 deletions

2
.gitignore vendored
View File

@ -24,3 +24,5 @@ go.work
.vscode .vscode
# Shield all log files in the log folder # Shield all log files in the log folder
/log/ /log/
# Shield config files in the config folder
/config/config.yaml

View File

@ -66,17 +66,16 @@ func MeasurementRecommendHandler(c *gin.Context) {
fmt.Printf("finalOffset:%v\n", finalOffset) fmt.Printf("finalOffset:%v\n", finalOffset)
resultRecommends := make([]string, 0, len(recommends)) resultRecommends := make([]string, 0, len(recommends))
seen := make(map[string]struct{}) // 使用空结构体节省内存 seen := make(map[string]struct{})
for _, recommend := range recommends { for _, recommend := range recommends {
recommendation := recommend[finalOffset:] recommendTerm := recommend[finalOffset:]
fmt.Printf("resultRecommend:%s\n", recommendation) fmt.Printf("resultRecommend:%s\n", recommendTerm)
fmt.Printf("len of resultRecommend:%d\n", len(recommendation)) fmt.Printf("len of resultRecommend:%d\n", len(recommendTerm))
if len(recommendTerm) != 0 {
if len(recommendation) != 0 { if _, exists := seen[recommendTerm]; !exists {
if _, exists := seen[recommendation]; !exists { seen[recommendTerm] = struct{}{}
seen[recommendation] = struct{}{} resultRecommends = append(resultRecommends, recommendTerm)
resultRecommends = append(resultRecommends, recommendation)
} }
} }
} }