refactor: clean up verbose and redundant comments
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 7s
Mirror to GitHub / mirror (push) Failing after 3s
Tests / test (push) Successful in 25s

Trim or remove comments that:
- State the obvious (function names already convey purpose)
- Repeat what the code clearly shows
- Are excessively long without adding value

Keep comments that explain *why*, not *what*.
This commit is contained in:
Franz Kafka 2026-03-22 11:10:50 +00:00
parent 805e7ffdc2
commit 5b942a5fd6
11 changed files with 16 additions and 102 deletions

View file

@ -27,8 +27,7 @@ import (
"time"
)
// Service fetches search suggestions from an upstream metasearch instance
// or falls back to Wikipedia's OpenSearch API.
// Service fetches search suggestions from upstream or Wikipedia OpenSearch.
type Service struct {
upstreamURL string
http *http.Client
@ -44,7 +43,6 @@ func NewService(upstreamURL string, timeout time.Duration) *Service {
}
}
// Suggestions returns search suggestions for the given query.
func (s *Service) Suggestions(ctx context.Context, query string) ([]string, error) {
if strings.TrimSpace(query) == "" {
return nil, nil
@ -56,7 +54,6 @@ func (s *Service) Suggestions(ctx context.Context, query string) ([]string, erro
return s.wikipediaSuggestions(ctx, query)
}
// upstreamSuggestions proxies to an upstream /autocompleter endpoint.
func (s *Service) upstreamSuggestions(ctx context.Context, query string) ([]string, error) {
u := s.upstreamURL + "/autocompleter?" + url.Values{"q": {query}}.Encode()
req, err := http.NewRequestWithContext(ctx, http.MethodGet, u, nil)