mirror of
https://github.com/octoleo/restic.git
synced 2024-12-22 10:58:55 +00:00
all: Minor cleanups
if x { return true } return false => return x fmt.Sprintf("%v", x) => fmt.Sprint(x) or x.String() The fmt.Sprintf idiom is still used in the SecretString tests, where it serves security hardening.
This commit is contained in:
parent
d03460010f
commit
22147e1e02
@ -217,7 +217,7 @@ func TestTestWalkFiles(t *testing.T) {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
got[p] = fmt.Sprintf("%v", item)
|
got[p] = fmt.Sprint(item)
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
|
2
internal/cache/file_test.go
vendored
2
internal/cache/file_test.go
vendored
@ -97,7 +97,7 @@ func TestFiles(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, tpe := range tests {
|
for _, tpe := range tests {
|
||||||
t.Run(fmt.Sprintf("%v", tpe), func(t *testing.T) {
|
t.Run(tpe.String(), func(t *testing.T) {
|
||||||
ids := generateRandomFiles(t, tpe, c)
|
ids := generateRandomFiles(t, tpe, c)
|
||||||
id := randomID(ids)
|
id := randomID(ids)
|
||||||
|
|
||||||
|
@ -114,11 +114,7 @@ func (h BlobHandles) Less(i, j int) bool {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if b < h[j].ID[k] {
|
return b < h[j].ID[k]
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return h[i].Type < h[j].Type
|
return h[i].Type < h[j].Type
|
||||||
@ -133,5 +129,5 @@ func (h BlobHandles) String() string {
|
|||||||
for _, e := range h {
|
for _, e := range h {
|
||||||
elements = append(elements, e.String())
|
elements = append(elements, e.String())
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%v", elements)
|
return fmt.Sprint(elements)
|
||||||
}
|
}
|
||||||
|
@ -65,5 +65,5 @@ func (ids IDs) String() string {
|
|||||||
for _, id := range ids {
|
for _, id := range ids {
|
||||||
elements = append(elements, shortID(id))
|
elements = append(elements, shortID(id))
|
||||||
}
|
}
|
||||||
return fmt.Sprintf("%v", elements)
|
return fmt.Sprint(elements)
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ func (TagList) Type() string {
|
|||||||
type TagLists []TagList
|
type TagLists []TagList
|
||||||
|
|
||||||
func (l TagLists) String() string {
|
func (l TagLists) String() string {
|
||||||
return fmt.Sprintf("%v", []TagList(l))
|
return fmt.Sprint([]TagList(l))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Flatten returns the list of all tags provided in TagLists
|
// Flatten returns the list of all tags provided in TagLists
|
||||||
|
Loading…
Reference in New Issue
Block a user