mirror of
https://github.com/Luzifer/staticmap.git
synced 2024-12-20 21:01:18 +00:00
Fix some linter advices
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
e597231825
commit
4bfeedaba8
2 changed files with 4 additions and 4 deletions
|
@ -26,15 +26,15 @@ func filesystemCache(center s2.LatLng, zoom int, marker []marker, x, y int) (io.
|
||||||
}
|
}
|
||||||
|
|
||||||
buf := new(bytes.Buffer)
|
buf := new(bytes.Buffer)
|
||||||
if _, err := io.Copy(buf, mapReader); err != nil {
|
if _, err = io.Copy(buf, mapReader); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := os.MkdirAll(path.Dir(cacheFileName), 0755); err != nil {
|
if err = os.MkdirAll(path.Dir(cacheFileName), 0700); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := ioutil.WriteFile(cacheFileName, buf.Bytes(), 0644); err != nil {
|
if err = ioutil.WriteFile(cacheFileName, buf.Bytes(), 0644); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
2
main.go
2
main.go
|
@ -91,7 +91,7 @@ func handleMapRequest(res http.ResponseWriter, r *http.Request) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if mapReader, err = cacheFunc(*center, zoom, markers, x, y); err != nil {
|
if mapReader, err = cacheFunc(*center, zoom, markers, x, y); err != nil {
|
||||||
log.Error("Map render failed: %s (Request: %s)", err, r.URL.String())
|
log.Errorf("Map render failed: %s (Request: %s)", err, r.URL.String())
|
||||||
http.Error(res, fmt.Sprintf("I experienced difficulties rendering your map: %s", err), http.StatusInternalServerError)
|
http.Error(res, fmt.Sprintf("I experienced difficulties rendering your map: %s", err), http.StatusInternalServerError)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue