Fix type of ID field in cmd_snapshots
type Snapshot
This commit is contained in:
parent
208edaa3d1
commit
26e266a951
2 changed files with 6 additions and 7 deletions
|
@ -166,7 +166,7 @@ func printSnapshotsReadable(stdout io.Writer, list []*restic.Snapshot) {
|
|||
type Snapshot struct {
|
||||
*restic.Snapshot
|
||||
|
||||
ID string `json:"id"`
|
||||
ID *restic.ID `json:"id"`
|
||||
}
|
||||
|
||||
// printSnapshotsJSON writes the JSON representation of list to stdout.
|
||||
|
@ -178,7 +178,7 @@ func printSnapshotsJSON(stdout io.Writer, list []*restic.Snapshot) error {
|
|||
|
||||
k := Snapshot{
|
||||
Snapshot: sn,
|
||||
ID: sn.ID().String(),
|
||||
ID: sn.ID(),
|
||||
}
|
||||
snapshots = append(snapshots, k)
|
||||
}
|
||||
|
|
|
@ -161,7 +161,7 @@ func testRunFind(t testing.TB, gopts GlobalOptions, pattern string) []string {
|
|||
return strings.Split(string(buf.Bytes()), "\n")
|
||||
}
|
||||
|
||||
func testRunSnapshots(t testing.TB, gopts GlobalOptions) (*Snapshot, map[string]Snapshot) {
|
||||
func testRunSnapshots(t testing.TB, gopts GlobalOptions) (newest *Snapshot, snapmap map[restic.ID]Snapshot) {
|
||||
buf := bytes.NewBuffer(nil)
|
||||
globalOptions.stdout = buf
|
||||
globalOptions.JSON = true
|
||||
|
@ -177,15 +177,14 @@ func testRunSnapshots(t testing.TB, gopts GlobalOptions) (*Snapshot, map[string]
|
|||
snapshots := []Snapshot{}
|
||||
OK(t, json.Unmarshal(buf.Bytes(), &snapshots))
|
||||
|
||||
var newest *Snapshot
|
||||
snapmap := make(map[string]Snapshot, len(snapshots))
|
||||
snapmap = make(map[restic.ID]Snapshot, len(snapshots))
|
||||
for _, sn := range snapshots {
|
||||
snapmap[sn.ID] = sn
|
||||
snapmap[*sn.ID] = sn
|
||||
if newest == nil || sn.Time.After(newest.Time) {
|
||||
newest = &sn
|
||||
}
|
||||
}
|
||||
return newest, snapmap
|
||||
return
|
||||
}
|
||||
|
||||
func testRunForget(t testing.TB, gopts GlobalOptions, args ...string) {
|
||||
|
|
Loading…
Reference in a new issue