From 65040e6b6e07a4275097c5e09a2d23e91d1b5c10 Mon Sep 17 00:00:00 2001 From: Kit Patella Date: Tue, 10 Sep 2024 15:03:35 -0700 Subject: [PATCH] chore(internal|test): finish removing named returns outside of package and extensions Signed-off-by: Kit Patella --- src/internal/agent/hooks/argocd-application.go | 5 ++--- src/internal/agent/hooks/argocd-repository.go | 2 +- src/internal/agent/hooks/flux-gitrepo.go | 2 +- src/test/e2e/28_wait_test.go | 3 ++- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/internal/agent/hooks/argocd-application.go b/src/internal/agent/hooks/argocd-application.go index b234f29e84..e7351c89fd 100644 --- a/src/internal/agent/hooks/argocd-application.go +++ b/src/internal/agent/hooks/argocd-application.go @@ -59,7 +59,7 @@ func NewApplicationMutationHook(ctx context.Context, cluster *cluster.Cluster) o } // mutateApplication mutates the git repository url to point to the repository URL defined in the ZarfState. -func mutateApplication(ctx context.Context, r *v1.AdmissionRequest, cluster *cluster.Cluster) (result *operations.Result, err error) { +func mutateApplication(ctx context.Context, r *v1.AdmissionRequest, cluster *cluster.Cluster) (*operations.Result, error) { state, err := cluster.LoadZarfState(ctx) if err != nil { return nil, err @@ -72,8 +72,7 @@ func mutateApplication(ctx context.Context, r *v1.AdmissionRequest, cluster *clu return nil, fmt.Errorf(lang.ErrUnmarshal, err) } - patches := []operations.PatchOperation{} - + patches := make([]operations.PatchOperation, 0) if app.Spec.Source != nil { patchedURL, err := getPatchedRepoURL(app.Spec.Source.RepoURL, state.GitServer, r) if err != nil { diff --git a/src/internal/agent/hooks/argocd-repository.go b/src/internal/agent/hooks/argocd-repository.go index 1875772d05..cf2e9d895e 100644 --- a/src/internal/agent/hooks/argocd-repository.go +++ b/src/internal/agent/hooks/argocd-repository.go @@ -47,7 +47,7 @@ func NewRepositorySecretMutationHook(ctx context.Context, cluster *cluster.Clust } // mutateRepositorySecret mutates the git URL in the ArgoCD repository secret to point to the repository URL defined in the ZarfState. -func mutateRepositorySecret(ctx context.Context, r *v1.AdmissionRequest, cluster *cluster.Cluster) (result *operations.Result, err error) { +func mutateRepositorySecret(ctx context.Context, r *v1.AdmissionRequest, cluster *cluster.Cluster) (*operations.Result, error) { isCreate := r.Operation == v1.Create isUpdate := r.Operation == v1.Update var isPatched bool diff --git a/src/internal/agent/hooks/flux-gitrepo.go b/src/internal/agent/hooks/flux-gitrepo.go index 2fda2969bb..77447b7c34 100644 --- a/src/internal/agent/hooks/flux-gitrepo.go +++ b/src/internal/agent/hooks/flux-gitrepo.go @@ -37,7 +37,7 @@ func NewGitRepositoryMutationHook(ctx context.Context, cluster *cluster.Cluster) } // mutateGitRepoCreate mutates the git repository url to point to the repository URL defined in the ZarfState. -func mutateGitRepo(ctx context.Context, r *v1.AdmissionRequest, cluster *cluster.Cluster) (result *operations.Result, err error) { +func mutateGitRepo(ctx context.Context, r *v1.AdmissionRequest, cluster *cluster.Cluster) (*operations.Result, error) { var ( patches []operations.PatchOperation isPatched bool diff --git a/src/test/e2e/28_wait_test.go b/src/test/e2e/28_wait_test.go index e150d163fd..e67b60d178 100644 --- a/src/test/e2e/28_wait_test.go +++ b/src/test/e2e/28_wait_test.go @@ -20,7 +20,8 @@ type zarfCommandResult struct { err error } -func zarfCommandWStruct(t *testing.T, e2e test.ZarfE2ETest, path string) (result zarfCommandResult) { +func zarfCommandWStruct(t *testing.T, e2e test.ZarfE2ETest, path string) zarfCommandResult { + result := zarfCommandResult{} result.stdOut, result.stdErr, result.err = e2e.Zarf(t, "package", "deploy", path, "--confirm") return result }