diff --git a/controllers/goharbor/project/memberships.go b/controllers/goharbor/project/memberships.go index 536a4ede6..c1ba28ebb 100644 --- a/controllers/goharbor/project/memberships.go +++ b/controllers/goharbor/project/memberships.go @@ -79,10 +79,7 @@ func (r *Reconciler) reconcileMembership(hp *goharborv1.HarborProject, log logr. log.Info("Start reconcile", "current members", currentMembershipsCnt, "desired members", desiredMembershipsCnt) // find differences between current and desired members. - differences, err := findDifferences(currentMemberships, desiredMemberships, log) - if err != nil { - return err - } + differences := findDifferences(currentMemberships, desiredMemberships, log) err = r.updateMemberships(hp, differences, log) if err != nil { @@ -105,7 +102,7 @@ func (r *Reconciler) reconcileMembership(hp *goharborv1.HarborProject, log logr. return nil } -func findDifferences(currentMemberships []*models.ProjectMemberEntity, desiredMemberships []models.ProjectMember, log logr.Logger) (*memberDifferences, error) { +func findDifferences(currentMemberships []*models.ProjectMemberEntity, desiredMemberships []models.ProjectMember, log logr.Logger) *memberDifferences { differences := memberDifferences{ update: []memberUpdate{}, create: []*models.ProjectMember{}, @@ -156,7 +153,7 @@ func findDifferences(currentMemberships []*models.ProjectMemberEntity, desiredMe log.Info("finished planning project member reconcile.", "create", len(differences.create), "update", len(differences.update), "delete", len(differences.delete)) - return &differences, nil + return &differences } func (r *Reconciler) updateMemberships(p *goharborv1.HarborProject, differences *memberDifferences, log logr.Logger) error { diff --git a/controllers/goharbor/project/quota.go b/controllers/goharbor/project/quota.go index 231524e5b..670aff18f 100644 --- a/controllers/goharbor/project/quota.go +++ b/controllers/goharbor/project/quota.go @@ -19,7 +19,7 @@ func (r *Reconciler) reconcileQuota(hp *goharborv1.HarborProject, log logr.Logge var projectQuota *models.Quota - if hp.Status.QuotaID == 0 { + if hp.Status.QuotaID == 0 { //nolint:nestif // QuotaID in custom resource still undefined. Get Quota via ProjectID quota, err := r.Harbor.GetQuotaByProjectID(hp.Status.ProjectID) if err != nil { diff --git a/pkg/rest/v2/project.go b/pkg/rest/v2/project.go index 79da19614..c427a0594 100644 --- a/pkg/rest/v2/project.go +++ b/pkg/rest/v2/project.go @@ -19,6 +19,7 @@ import ( const ( paginationSize int64 = 25 + baseInt10 int = 10 ) // EnsureProject ensures the specified project is on the harbor server @@ -199,7 +200,7 @@ func (c *Client) DeleteProject(name string) error { params := project.NewDeleteProjectParamsWithContext(c.context). WithTimeout(c.timeout). - WithProjectNameOrID(strconv.FormatInt(int64(p.ProjectID), 10)) + WithProjectNameOrID(strconv.FormatInt(int64(p.ProjectID), baseInt10)) if _, err = c.harborClient.Client.Project.DeleteProject(c.context, params); err != nil { return fmt.Errorf("error while deleting project \"%s\" (%d): %w", name, p.ProjectID, err)