fix: error handling, defer cleanup, graceful shutdown, golangci-lint setup

This commit is contained in:
2026-04-18 17:32:34 +03:00
parent 44cb3c6576
commit ebb8cded41
16 changed files with 174 additions and 47 deletions

View File

@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"log/slog"
"net/http"
neturl "net/url"
"strconv"
@@ -35,7 +36,11 @@ func Geocode(ctx context.Context, address string) (lat, lon float64, err error)
if err != nil {
return 0, 0, err
}
defer resp.Body.Close()
defer func() {
if err := resp.Body.Close(); err != nil {
slog.Warn("failed to close response body", slog.String("error", err.Error()))
}
}()
var results []struct {
Lat string `json:"lat"`