From d50857c52824718ba270896c5435edeb0c727085 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Sun, 8 Aug 2021 23:43:40 +0200 Subject: [PATCH] Fix error format in log.Printf calls --- search.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/search.go b/search.go index 4c57942..57ed4a3 100644 --- a/search.go +++ b/search.go @@ -117,7 +117,7 @@ func (s *searchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { for _, page := range pages { err = saveBlocksFromPage("data", page) if err != nil { - log.Printf("error while processing blocks from page %s: %w", page.Name, err) + log.Printf("error while processing blocks from page %s: %v", page.Name, err) continue } } @@ -141,7 +141,7 @@ func (s *searchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { log.Println("saveLinks") err = saveLinks(mp) if err != nil { - log.Printf("error while saving links %w", err) + log.Printf("error while saving links %v", err) http.Error(w, err.Error(), 500) return } @@ -149,14 +149,14 @@ func (s *searchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { log.Println("saveBackrefs") err = saveBackrefs("data/backrefs.json", refs) if err != nil { - log.Printf("error while saving backrefs %w", err) + log.Printf("error while saving backrefs %v", err) http.Error(w, err.Error(), 500) return } err = os.RemoveAll("data/_tmp_index") if err != nil { - log.Printf("error while remove old index %w", err) + log.Printf("error while remove old index %v", err) http.Error(w, err.Error(), 500) return } @@ -170,14 +170,14 @@ func (s *searchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { for _, page := range pages { searchObjects, err := createSearchObjects(page.Name) if err != nil { - log.Printf("error while creating search object %s: %w", page.Title, err) + log.Printf("error while creating search object %s: %v", page.Title, err) continue } for _, so := range searchObjects { err = index.Index(so.ID, so) if err != nil { - log.Printf("error while indexing %s: %w", page.Title, err) + log.Printf("error while indexing %s: %v", page.Title, err) continue } } @@ -185,19 +185,19 @@ func (s *searchHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) { err = os.Rename("data/_page-index", "data/_page-index-old") if err != nil { - log.Printf("error while resetting index: %w", err) + log.Printf("error while resetting index: %v", err) http.Error(w, err.Error(), 500) return } err = os.Rename("data/_tmp_index", "data/_page-index") if err != nil { - log.Printf("error while putthing new index in place: %w", err) + log.Printf("error while putthing new index in place: %v", err) http.Error(w, err.Error(), 500) return } err = os.RemoveAll("data/_page-index-old") if err != nil { - log.Printf("error while remove old index %w", err) + log.Printf("error while remove old index %v", err) http.Error(w, err.Error(), 500) return }