Skip to content

Commit

Permalink
use topLevelTargets() instead of targets()
Browse files Browse the repository at this point in the history
Signed-off-by: Marina Moore <[email protected]>
  • Loading branch information
mnm678 committed Jan 19, 2022
1 parent 06228a9 commit 3088a24
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions repo.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ func (r *Repo) AddTargetsWithDigest(digest string, digestAlg string, length int6
expires := data.DefaultExpires("targets")

// TODO: support delegated targets
t, err := r.targets()
t, err := r.topLevelTargets()
if err != nil {
return err
}
Expand Down Expand Up @@ -780,7 +780,7 @@ func (r *Repo) writeTargetWithExpires(t *data.Targets, expires time.Time) error
t.Version++
}

err = r.setTopLevelMeta("targets.json", t)
err := r.setTopLevelMeta("targets.json", t)
if err == nil {
fmt.Println("Added/staged targets:")
for k := range t.Targets {
Expand Down
2 changes: 1 addition & 1 deletion repo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1821,7 +1821,7 @@ func (rs *RepoSuite) TestSignDigest(c *C) {
hex_digest_bytes := data.HexBytes(digest_bytes)
c.Assert(err, IsNil)

targets, err := r.targets()
targets, err := r.topLevelTargets()
c.Assert(err, IsNil)
c.Assert(targets.Targets["sha256:bc11b176a293bb341a0f2d0d226f52e7fcebd186a7c4dfca5fc64f305f06b94c"].FileMeta.Length, Equals, size)
c.Assert(targets.Targets["sha256:bc11b176a293bb341a0f2d0d226f52e7fcebd186a7c4dfca5fc64f305f06b94c"].FileMeta.Hashes["sha256"], DeepEquals, hex_digest_bytes)
Expand Down

0 comments on commit 3088a24

Please sign in to comment.