From aea881c15cd956434599b1eb66f3cf48a6059d32 Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 30 Nov 2024 12:39:17 +0100 Subject: [PATCH] Lint: Fix linter errors Signed-off-by: Knut Ahlers --- main.go | 8 ++++---- map.go | 6 +++--- postmap.go | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/main.go b/main.go index 392472e..d75b577 100644 --- a/main.go +++ b/main.go @@ -67,7 +67,7 @@ func main() { rateLimit.SetIPLookups([]string{"X-Forwarded-For", "RemoteAddr", "X-Real-IP"}) r := mux.NewRouter() - r.HandleFunc("/status", func(res http.ResponseWriter, r *http.Request) { http.Error(res, "I'm fine", http.StatusOK) }) + r.HandleFunc("/status", func(res http.ResponseWriter, _ *http.Request) { http.Error(res, "I'm fine", http.StatusOK) }) r.Handle("/map.png", tollbooth.LimitFuncHandler(rateLimit, handleMapRequest)).Methods("GET") r.Handle("/map.png", tollbooth.LimitFuncHandler(rateLimit, handlePostMapRequest)).Methods("POST") @@ -77,7 +77,7 @@ func main() { ReadHeaderTimeout: time.Second, } - logrus.WithField("version", version).Info("staticmap started") + logrus.WithField("version", version).WithField("addr", cfg.Listen).Info("staticmap started") if err = server.ListenAndServe(); err != nil { logrus.WithError(err).Fatal("running HTTP server") } @@ -173,7 +173,7 @@ func parseCoordinate(coord string) (s2.LatLng, error) { } parts := strings.Split(coord, ",") - if len(parts) != 2 { //nolint:gomnd + if len(parts) != 2 { //nolint:mnd return s2.LatLng{}, errors.New("Coordinate not in format lat,lon") } @@ -200,7 +200,7 @@ func parseSize(size string) (x, y int, err error) { } parts := strings.Split(size, "x") - if len(parts) != 2 { //nolint:gomnd + if len(parts) != 2 { //nolint:mnd return 0, 0, errors.New("Size not in format 600x300") } diff --git a/map.go b/map.go index 9c44bc5..3523cdd 100644 --- a/map.go +++ b/map.go @@ -14,7 +14,7 @@ import ( "github.com/pkg/errors" ) -//nolint:gomnd // these are the "constant" definitions +//nolint:mnd // these are the "constant" definitions var markerColors = map[string]color.Color{ "black": color.RGBA{R: 145, G: 145, B: 145, A: 0xff}, "brown": color.RGBA{R: 178, G: 154, B: 123, A: 0xff}, @@ -30,7 +30,7 @@ var markerColors = map[string]color.Color{ type markerSize float64 -//nolint:gomnd // these are the "constant" definitions +//nolint:mnd // these are the "constant" definitions var markerSizes = map[string]markerSize{ "tiny": 10, "mid": 15, @@ -97,7 +97,7 @@ func generateMap(opts generateMapConfig) (io.Reader, error) { if opts.Markers != nil { for _, m := range opts.Markers { - ctx.AddMarker(staticMap.NewMarker(m.pos, m.color, float64(m.size))) + ctx.AddObject(staticMap.NewMarker(m.pos, m.color, float64(m.size))) } } diff --git a/postmap.go b/postmap.go index e13249d..d094caf 100644 --- a/postmap.go +++ b/postmap.go @@ -105,7 +105,7 @@ func (p postMapOverlay) toOverlays() ([]*staticMap.TileProvider, error) { result = append(result, &staticMap.TileProvider{ Name: fmt.Sprintf("%x", sha256.Sum256([]byte(pat))), - TileSize: 256, //nolint:gomnd + TileSize: 256, //nolint:mnd URLPattern: pat, }) }