func applyTargetsChange(repo *tuf.Repo, c changelist.Change) error { var err error switch c.Action() { case changelist.ActionCreate: logrus.Debug("changelist add: ", c.Path()) meta := &data.FileMeta{} err = json.Unmarshal(c.Content(), meta) if err != nil { return err } files := data.Files{c.Path(): *meta} _, err = repo.AddTargets(c.Scope(), files) case changelist.ActionDelete: logrus.Debug("changelist remove: ", c.Path()) err = repo.RemoveTargets(c.Scope(), c.Path()) default: logrus.Debug("action not yet supported: ", c.Action()) } if err != nil { return err } return nil }