mirror of
https://github.com/karust/openserp.git
synced 2026-08-16 21:36:06 +08:00
remove dead code, pin golangci linters
This commit is contained in:
@@ -1,6 +1,19 @@
|
||||
run:
|
||||
tests: true
|
||||
timeout: 5m
|
||||
go: "1.24"
|
||||
|
||||
# Pinned set so CI and local runs agree
|
||||
linters:
|
||||
disable-all: true
|
||||
enable:
|
||||
- govet
|
||||
- staticcheck
|
||||
- gosimple
|
||||
- errcheck
|
||||
- ineffassign
|
||||
- unused
|
||||
- misspell
|
||||
|
||||
issues:
|
||||
max-issues-per-linter: 0
|
||||
|
||||
@@ -293,7 +293,7 @@ func initializeConfig(cmd *cobra.Command) error {
|
||||
envKey := envPrefix + "_" + strings.ToUpper(strings.ReplaceAll(key, ".", "_"))
|
||||
err := v.BindEnv(key, envKey)
|
||||
if err != nil {
|
||||
logrus.WithError(err).Error(fmt.Sprintf("Unable to bind ENV valye: %v", err))
|
||||
logrus.WithError(err).Error(fmt.Sprintf("Unable to bind ENV value: %v", err))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -104,51 +104,3 @@ func setSeparatedAdAbsoluteRanks(results []core.SearchResult, start int) {
|
||||
organicAbsoluteRank++
|
||||
}
|
||||
}
|
||||
|
||||
// // parseEcosiaImageItem extracts a single image card from a goquery Selection.
|
||||
// func parseEcosiaImageItem(item *goquery.Selection, rank int) (core.SearchResult, bool) {
|
||||
// linkTag := item.Find(Selectors.ImageLink).First()
|
||||
// if linkTag.Length() == 0 {
|
||||
// return core.SearchResult{}, false
|
||||
// }
|
||||
// href, exists := linkTag.Attr("href")
|
||||
// if !exists {
|
||||
// return core.SearchResult{}, false
|
||||
// }
|
||||
// imgURL := strings.TrimSpace(href)
|
||||
// if imgURL == "" {
|
||||
// return core.SearchResult{}, false
|
||||
// }
|
||||
|
||||
// title := ""
|
||||
// if img := linkTag.Find("img").First(); img.Length() > 0 {
|
||||
// if alt, err := img.Attr("alt"); err {
|
||||
// title = strings.TrimSpace(alt)
|
||||
// }
|
||||
// }
|
||||
|
||||
// source := ""
|
||||
// if s := item.Find(Selectors.ImageSource).First(); s.Length() > 0 {
|
||||
// source = strings.TrimSpace(s.Text())
|
||||
// }
|
||||
// dims := ""
|
||||
// if d := item.Find(Selectors.ImageDims).First(); d.Length() > 0 {
|
||||
// dims = strings.TrimSpace(d.Text())
|
||||
// }
|
||||
|
||||
// desc := source
|
||||
// if dims != "" {
|
||||
// if source != "" {
|
||||
// desc = fmt.Sprintf("%s (%s)", source, dims)
|
||||
// } else {
|
||||
// desc = dims
|
||||
// }
|
||||
// }
|
||||
|
||||
// return core.SearchResult{
|
||||
// Rank: rank,
|
||||
// URL: imgURL,
|
||||
// Title: title,
|
||||
// Description: desc,
|
||||
// }, true
|
||||
// }
|
||||
|
||||
@@ -335,6 +335,7 @@ func (gogl *Google) Search(ctx context.Context, query core.Query) (results []cor
|
||||
srchRes.AbsoluteRank = absoluteRank
|
||||
adRank++
|
||||
absoluteRank++
|
||||
searchResults = append(searchResults, srchRes)
|
||||
|
||||
} else if isAnswerBox {
|
||||
// 2. Parse answer boxes
|
||||
@@ -463,18 +464,6 @@ func (gogl *Google) Search(ctx context.Context, query core.Query) (results []cor
|
||||
} else {
|
||||
continue
|
||||
}
|
||||
|
||||
if srchRes.Ad && srchRes.Rank == 0 {
|
||||
srchRes.Rank = adRank
|
||||
adRank++
|
||||
} else if !srchRes.Ad {
|
||||
srchRes.Rank = rank
|
||||
}
|
||||
if srchRes.AbsoluteRank == 0 {
|
||||
srchRes.AbsoluteRank = absoluteRank
|
||||
absoluteRank++
|
||||
}
|
||||
searchResults = append(searchResults, srchRes)
|
||||
}
|
||||
|
||||
deduped := core.DeduplicateResults(searchResults)
|
||||
|
||||
@@ -262,7 +262,7 @@ func BuildURL(q core.Query) (string, error) {
|
||||
if q.DateInterval != "" {
|
||||
intervals := strings.Split(q.DateInterval, "..")
|
||||
if len(intervals) != 2 {
|
||||
return "", errors.New("incorrect data interval provided")
|
||||
return "", errors.New("incorrect date interval provided")
|
||||
}
|
||||
|
||||
dataParam := fmt.Sprintf("cdr:1,cd_min:%s,cd_max:%s", intervals[0], intervals[1])
|
||||
@@ -343,7 +343,7 @@ func BuildImageURL(q core.Query) (string, error) {
|
||||
if q.DateInterval != "" {
|
||||
intervals := strings.Split(q.DateInterval, "..")
|
||||
if len(intervals) != 2 {
|
||||
return "", errors.New("incorrect data interval provided")
|
||||
return "", errors.New("incorrect date interval provided")
|
||||
}
|
||||
|
||||
dataParam := fmt.Sprintf("cdr:1,cd_min:%s,cd_max:%s", intervals[0], intervals[1])
|
||||
|
||||
@@ -54,7 +54,6 @@ func BuildURL(q core.Query, page int) (string, error) {
|
||||
// BuildImageURL builds a Yandex image search URL for the provided query and
|
||||
// page index. It returns an error when the resulting query text is empty.
|
||||
func BuildImageURL(q core.Query, page int) (string, error) {
|
||||
// TODO: Add other parameters
|
||||
base, _ := url.Parse(baseURL)
|
||||
base.Path += "images/search/"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user