mirror of https://github.com/perkeep/perkeep.git
all: address misc staticcheck warnings
Co-authored-by: Oleksandr Redko <oleksandr.red+github@gmail.com> Signed-off-by: Brad Fitzpatrick <brad@danga.com>
This commit is contained in:
parent
46a308572a
commit
7e486bd9a7
|
@ -139,8 +139,7 @@ func (s *DriveService) Fetch(ctx context.Context, title string) (body io.ReadClo
|
|||
return
|
||||
}
|
||||
|
||||
req, _ := http.NewRequest("GET", file.DownloadUrl, nil)
|
||||
req.WithContext(ctx)
|
||||
req, _ := http.NewRequestWithContext(ctx, "GET", file.DownloadUrl, nil)
|
||||
var resp *http.Response
|
||||
if resp, err = s.client.Transport.RoundTrip(req); err != nil {
|
||||
return
|
||||
|
|
|
@ -107,6 +107,9 @@ func TestS3WriteFiles(t *testing.T) {
|
|||
}
|
||||
defer dir.Close()
|
||||
names, err := dir.Readdirnames(-1)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
for _, name := range names {
|
||||
f, err := os.Open(filepath.Join(*flagTestData, name))
|
||||
if err != nil {
|
||||
|
|
|
@ -42,7 +42,7 @@ func ParseFields(v []byte, dst ...interface{}) error {
|
|||
case *blob.Ref:
|
||||
br, ok := blob.ParseBytes(thisv)
|
||||
if !ok {
|
||||
|
||||
return fmt.Errorf("invalid blobref %q", thisv)
|
||||
}
|
||||
*dv = br
|
||||
case *uint32:
|
||||
|
|
|
@ -229,10 +229,10 @@ func atomTitle(t *atom.Text) string {
|
|||
if t == nil {
|
||||
return ""
|
||||
}
|
||||
if t.Type == "html" {
|
||||
// see: https://github.com/mjibson/goread/blob/59aec794f3ef87b36c1bac029438c33a6aa6d8d3/utils.go#L533
|
||||
//return html.UnescapeString(sanitizer.StripTags(t.Body))
|
||||
}
|
||||
// if t.Type == "html" {
|
||||
// see: https://github.com/mjibson/goread/blob/59aec794f3ef87b36c1bac029438c33a6aa6d8d3/utils.go#L533
|
||||
// return html.UnescapeString(sanitizer.StripTags(t.Body))
|
||||
// }
|
||||
return textTitle(t.Body)
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,6 @@ import (
|
|||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
|
||||
"go4.org/syncutil"
|
||||
|
||||
|
@ -154,7 +153,6 @@ func (dr *DirReader) Readdir(ctx context.Context, n int) (entries []DirectoryEnt
|
|||
up = len(sts)
|
||||
} else {
|
||||
if n > (len(sts) - dr.current) {
|
||||
err = io.EOF
|
||||
up = len(sts)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -612,9 +612,7 @@ func (bb *Builder) SetStaticSetMembers(members []blob.Ref) []*Blob {
|
|||
subss := ss.SetStaticSetMembers(members[i*perSubset : (i+1)*perSubset])
|
||||
subsets = append(subsets, ss.Blob())
|
||||
allSubsets = append(allSubsets, ss.Blob())
|
||||
for _, v := range subss {
|
||||
allSubsets = append(allSubsets, v)
|
||||
}
|
||||
allSubsets = append(allSubsets, subss...)
|
||||
}
|
||||
|
||||
// Deal with the rest (of the euclidean division)
|
||||
|
|
|
@ -370,8 +370,7 @@ func TestAsClaimAndAsShare(t *testing.T) {
|
|||
|
||||
bb := NewSetAttributeClaim(br, "title", "Test Title")
|
||||
getBlob := func() *Blob {
|
||||
var c *Blob
|
||||
c = bb.Blob()
|
||||
c := bb.Blob()
|
||||
c.ss.Sig = "non-null-sig" // required by AsShare
|
||||
return c
|
||||
}
|
||||
|
@ -420,7 +419,7 @@ func TestAsClaimAndAsShare(t *testing.T) {
|
|||
bb = bb.SetClaimDate(time.Now())
|
||||
// Would be better to use search.SearchQuery but we can't reference it here.
|
||||
bb.SetShareSearch(&struct{}{})
|
||||
s, ok = getBlob().AsShare()
|
||||
_, ok = getBlob().AsShare()
|
||||
if !ok {
|
||||
t.Error("Share claim failed to return share with search")
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ func TestUploadFile(t *testing.T) {
|
|||
testUploadFile(t, c, f, false)
|
||||
testUploadFile(t, c, f, true)
|
||||
|
||||
f.modTime.Add(time.Hour)
|
||||
f.modTime = f.modTime.Add(time.Hour)
|
||||
testUploadFile(t, c, f, true)
|
||||
|
||||
f.name = "baz.txt"
|
||||
|
|
|
@ -25,11 +25,15 @@ import (
|
|||
"perkeep.org/pkg/blobserver"
|
||||
)
|
||||
|
||||
// NewLoader
|
||||
// NewLoader returns a new Loader.
|
||||
func NewLoader() *Loader {
|
||||
return &Loader{}
|
||||
}
|
||||
|
||||
// Loader is a test implementation of blobserver.Loader.
|
||||
//
|
||||
// Its zero value is ready for use, but callers empirically (historically) have
|
||||
// used the NewLoader constructor, despite it being kinda useless.
|
||||
type Loader struct {
|
||||
mu sync.Mutex
|
||||
sto map[string]blobserver.Storage
|
||||
|
|
Loading…
Reference in New Issue