app/...: fix staticcheck warnings

Signed-off-by: Brad Fitzpatrick <brad@danga.com>
This commit is contained in:
Brad Fitzpatrick 2024-01-14 12:53:42 -08:00
parent 526640422e
commit 45f873a1c8
5 changed files with 8 additions and 5 deletions

View File

@ -244,6 +244,9 @@ func TestPublishMembers(t *testing.T) {
} }
members, err := pr.subjectMembers(res.Meta) members, err := pr.subjectMembers(res.Meta)
if err != nil {
t.Errorf("subjectMembers: %v", err)
}
if len(members.Members) != 2 { if len(members.Members) != 2 {
t.Errorf("Expected two members in publish root (one camlipath, one camlimember), got %d", len(members.Members)) t.Errorf("Expected two members in publish root (one camlipath, one camlimember), got %d", len(members.Members))
} }

View File

@ -20,6 +20,7 @@ import (
"context" "context"
"errors" "errors"
"fmt" "fmt"
"log"
"os" "os"
"sort" "sort"
"strconv" "strconv"
@ -151,8 +152,9 @@ func (h *handler) describeScan(b *search.DescribedBlob) (mediaObject, error) {
if documentRef != "" { if documentRef != "" {
var ok bool var ok bool
document, ok = blob.Parse(documentRef) document, ok = blob.Parse(documentRef)
if ok { if !ok {
// TODO(mpl): more to be done here ? Do we ever want to display something about the document of a scan ? // TODO(mpl): more to be done here ? Do we ever want to display something about the document of a scan ?
log.Printf("warning: failed to parse document ref %q", documentRef)
} }
} }
content, ok := blob.Parse(attrs.Get("camliContent")) content, ok := blob.Parse(attrs.Get("camliContent"))

View File

@ -300,7 +300,6 @@ func baseURL(r *http.Request) string {
func (h *handler) handleUploadURL(w http.ResponseWriter, r *http.Request) { func (h *handler) handleUploadURL(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/plain") w.Header().Set("Content-Type", "text/plain")
fmt.Fprintf(w, "%supload", baseURL(r)) fmt.Fprintf(w, "%supload", baseURL(r))
return
} }
func (h *handler) handleUpload(w http.ResponseWriter, r *http.Request) { func (h *handler) handleUpload(w http.ResponseWriter, r *http.Request) {
@ -455,7 +454,6 @@ func (h *handler) handleResource(w http.ResponseWriter, r *http.Request) {
ih.MaxHeight = resized ih.MaxHeight = resized
} }
ih.ServeHTTP(w, r, mediaObject.contentRef) ih.ServeHTTP(w, r, mediaObject.contentRef)
return
} }
func (h *handler) handleMakedoc(w http.ResponseWriter, r *http.Request) { func (h *handler) handleMakedoc(w http.ResponseWriter, r *http.Request) {

View File

@ -500,6 +500,4 @@ func main() {
} }
scan() scan()
return
} }

View File

@ -19,6 +19,8 @@ TODO(steve.armstrong): Until app/scanningcabinet/handler.go handleUiFile()
properly manages Content-Type, be sure to update it whenever adding a new properly manages Content-Type, be sure to update it whenever adding a new
file type to the pattern below. file type to the pattern below.
*/ */
// Package ui contains the embedded JS/CSS assets for the scanningcabinet app.
package ui // import "perkeep.org/app/scanningcabinet/ui" package ui // import "perkeep.org/app/scanningcabinet/ui"
import "embed" import "embed"