diff --git a/.github/workflows/ci-build.yaml b/.github/workflows/ci-build.yaml index 0ee9cb2f7155d..2f37c41c9ea60 100644 --- a/.github/workflows/ci-build.yaml +++ b/.github/workflows/ci-build.yaml @@ -79,7 +79,7 @@ jobs: uses: golangci/golangci-lint-action@639cd343e1d3b897ff35927a75193d57cfcba299 # v3.6.0 with: version: v1.51.0 - args: --timeout 10m --exclude SA5011 --verbose + args: --enable gofmt --timeout 10m --exclude SA5011 --verbose --max-issues-per-linter 0 --max-same-issues 0 test-go: name: Run unit tests for Go packages diff --git a/Makefile b/Makefile index 4786ac88340f1..d75fd364e31d9 100644 --- a/Makefile +++ b/Makefile @@ -352,7 +352,7 @@ lint-local: golangci-lint --version # NOTE: If you get a "Killed" OOM message, try reducing the value of GOGC # See https://github.com/golangci/golangci-lint#memory-usage-of-golangci-lint - GOGC=$(ARGOCD_LINT_GOGC) GOMAXPROCS=2 golangci-lint run --fix --verbose --timeout 3000s + GOGC=$(ARGOCD_LINT_GOGC) GOMAXPROCS=2 golangci-lint run --enable gofmt --fix --verbose --timeout 3000s --max-issues-per-linter 0 --max-same-issues 0 .PHONY: lint-ui lint-ui: test-tools-image @@ -651,4 +651,4 @@ help: @echo 'codegen:' @echo ' codegen(-local) -- if using -local, run the following targets first' @echo ' install-codegen-tools-local -- run this to install the codegen tools' - @echo ' install-go-tools-local -- run this to install go libraries for codegen' \ No newline at end of file + @echo ' install-go-tools-local -- run this to install go libraries for codegen' diff --git a/applicationset/generators/list.go b/applicationset/generators/list.go index d53da88c467f1..62b65650352a4 100644 --- a/applicationset/generators/list.go +++ b/applicationset/generators/list.go @@ -82,7 +82,7 @@ func (g *ListGenerator) GenerateParams(appSetGenerator *argoprojiov1alpha1.Appli if err != nil { return nil, fmt.Errorf("error unmarshling decoded ElementsYaml %v", err) } - res = append(res, yamlElements...) + res = append(res, yamlElements...) } return res, nil diff --git a/applicationset/generators/pull_request_test.go b/applicationset/generators/pull_request_test.go index 4ad069657f414..eb0b3bcdd8a90 100644 --- a/applicationset/generators/pull_request_test.go +++ b/applicationset/generators/pull_request_test.go @@ -27,7 +27,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) { return pullrequest.NewFakeService( ctx, []*pullrequest.PullRequest{ - &pullrequest.PullRequest{ + { Number: 1, Branch: "branch1", TargetBranch: "master", @@ -56,7 +56,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) { return pullrequest.NewFakeService( ctx, []*pullrequest.PullRequest{ - &pullrequest.PullRequest{ + { Number: 2, Branch: "feat/areally+long_pull_request_name_to_test_argo_slugification_and_branch_name_shortening_feature", TargetBranch: "feat/anotherreally+long_pull_request_name_to_test_argo_slugification_and_branch_name_shortening_feature", @@ -85,7 +85,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) { return pullrequest.NewFakeService( ctx, []*pullrequest.PullRequest{ - &pullrequest.PullRequest{ + { Number: 1, Branch: "a-very-short-sha", TargetBranch: "master", @@ -125,7 +125,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) { return pullrequest.NewFakeService( ctx, []*pullrequest.PullRequest{ - &pullrequest.PullRequest{ + { Number: 1, Branch: "branch1", TargetBranch: "master", @@ -162,7 +162,7 @@ func TestPullRequestGithubGenerateParams(t *testing.T) { return pullrequest.NewFakeService( ctx, []*pullrequest.PullRequest{ - &pullrequest.PullRequest{ + { Number: 1, Branch: "branch1", TargetBranch: "master", diff --git a/applicationset/generators/scm_provider_test.go b/applicationset/generators/scm_provider_test.go index b83f5d892312b..d51cb2703ad7f 100644 --- a/applicationset/generators/scm_provider_test.go +++ b/applicationset/generators/scm_provider_test.go @@ -108,26 +108,26 @@ func TestSCMProviderGenerateParams(t *testing.T) { }, expected: []map[string]interface{}{ { - "organization": "myorg", - "repository": "repo1", - "url": "git@github.com:myorg/repo1.git", - "branch": "main", + "organization": "myorg", + "repository": "repo1", + "url": "git@github.com:myorg/repo1.git", + "branch": "main", "branchNormalized": "main", - "sha": "0bc57212c3cbbec69d20b34c507284bd300def5b", - "short_sha": "0bc57212", - "short_sha_7": "0bc5721", - "labels": "prod,staging", + "sha": "0bc57212c3cbbec69d20b34c507284bd300def5b", + "short_sha": "0bc57212", + "short_sha_7": "0bc5721", + "labels": "prod,staging", }, { - "organization": "myorg", - "repository": "repo2", - "url": "git@github.com:myorg/repo2.git", - "branch": "main", + "organization": "myorg", + "repository": "repo2", + "url": "git@github.com:myorg/repo2.git", + "branch": "main", "branchNormalized": "main", - "sha": "59d0", - "short_sha": "59d0", - "short_sha_7": "59d0", - "labels": "", + "sha": "59d0", + "short_sha": "59d0", + "short_sha_7": "59d0", + "labels": "", }, }, }, diff --git a/applicationset/services/pull_request/gitea_test.go b/applicationset/services/pull_request/gitea_test.go index c450a40a268b6..125c8ee481b3a 100644 --- a/applicationset/services/pull_request/gitea_test.go +++ b/applicationset/services/pull_request/gitea_test.go @@ -269,9 +269,9 @@ func TestGetGiteaPRLabelNames(t *testing.T) { { Name: "PR has labels", PullLabels: []*gitea.Label{ - &gitea.Label{Name: "label1"}, - &gitea.Label{Name: "label2"}, - &gitea.Label{Name: "label3"}, + {Name: "label1"}, + {Name: "label2"}, + {Name: "label3"}, }, ExpectedResult: []string{"label1", "label2", "label3"}, }, diff --git a/applicationset/services/pull_request/github_test.go b/applicationset/services/pull_request/github_test.go index 4c89404c09a6a..c47031acb7e31 100644 --- a/applicationset/services/pull_request/github_test.go +++ b/applicationset/services/pull_request/github_test.go @@ -22,9 +22,9 @@ func TestContainLabels(t *testing.T) { Name: "Match labels", Labels: []string{"label1", "label2"}, PullLabels: []*github.Label{ - &github.Label{Name: toPtr("label1")}, - &github.Label{Name: toPtr("label2")}, - &github.Label{Name: toPtr("label3")}, + {Name: toPtr("label1")}, + {Name: toPtr("label2")}, + {Name: toPtr("label3")}, }, Expect: true, }, @@ -32,9 +32,9 @@ func TestContainLabels(t *testing.T) { Name: "Not match labels", Labels: []string{"label1", "label4"}, PullLabels: []*github.Label{ - &github.Label{Name: toPtr("label1")}, - &github.Label{Name: toPtr("label2")}, - &github.Label{Name: toPtr("label3")}, + {Name: toPtr("label1")}, + {Name: toPtr("label2")}, + {Name: toPtr("label3")}, }, Expect: false, }, @@ -42,9 +42,9 @@ func TestContainLabels(t *testing.T) { Name: "No specify", Labels: []string{}, PullLabels: []*github.Label{ - &github.Label{Name: toPtr("label1")}, - &github.Label{Name: toPtr("label2")}, - &github.Label{Name: toPtr("label3")}, + {Name: toPtr("label1")}, + {Name: toPtr("label2")}, + {Name: toPtr("label3")}, }, Expect: true, }, @@ -68,9 +68,9 @@ func TestGetGitHubPRLabelNames(t *testing.T) { { Name: "PR has labels", PullLabels: []*github.Label{ - &github.Label{Name: toPtr("label1")}, - &github.Label{Name: toPtr("label2")}, - &github.Label{Name: toPtr("label3")}, + {Name: toPtr("label1")}, + {Name: toPtr("label2")}, + {Name: toPtr("label3")}, }, ExpectedResult: []string{"label1", "label2", "label3"}, }, diff --git a/assets/embed.go b/assets/embed.go index 8095b0f282df3..ac148cafd3de6 100644 --- a/assets/embed.go +++ b/assets/embed.go @@ -3,5 +3,6 @@ package assets import "embed" // Embedded contains embedded assets +// //go:embed * var Embedded embed.FS diff --git a/cmd/argocd/commands/app_test.go b/cmd/argocd/commands/app_test.go index 673bceec7b632..0880fdc1c1ae5 100644 --- a/cmd/argocd/commands/app_test.go +++ b/cmd/argocd/commands/app_test.go @@ -307,8 +307,8 @@ func Test_groupObjsByKey(t *testing.T) { } expected := map[kube.ResourceKey]*unstructured.Unstructured{ - kube.ResourceKey{Group: "", Kind: "Pod", Namespace: "default", Name: "pod-name"}: localObjs[0], - kube.ResourceKey{Group: "apiextensions.k8s.io", Kind: "CustomResourceDefinition", Namespace: "", Name: "certificates.cert-manager.io"}: localObjs[1], + {Group: "", Kind: "Pod", Namespace: "default", Name: "pod-name"}: localObjs[0], + {Group: "apiextensions.k8s.io", Kind: "CustomResourceDefinition", Namespace: "", Name: "certificates.cert-manager.io"}: localObjs[1], } objByKey := groupObjsByKey(localObjs, liveObjs, "default") diff --git a/cmd/argocd/commands/applicationset_test.go b/cmd/argocd/commands/applicationset_test.go index ce6fab64526c3..18e5f85feebbc 100644 --- a/cmd/argocd/commands/applicationset_test.go +++ b/cmd/argocd/commands/applicationset_test.go @@ -40,12 +40,12 @@ func TestPrintApplicationSetTable(t *testing.T) { }, Spec: v1alpha1.ApplicationSetSpec{ Generators: []v1alpha1.ApplicationSetGenerator{ - v1alpha1.ApplicationSetGenerator{ + { Git: &v1alpha1.GitGenerator{ RepoURL: "https://github.com/argoproj/argo-cd.git", Revision: "head", Directories: []v1alpha1.GitDirectoryGeneratorItem{ - v1alpha1.GitDirectoryGeneratorItem{ + { Path: "applicationset/examples/git-generator-directory/cluster-addons/*", }, }, @@ -60,7 +60,7 @@ func TestPrintApplicationSetTable(t *testing.T) { }, Status: v1alpha1.ApplicationSetStatus{ Conditions: []v1alpha1.ApplicationSetCondition{ - v1alpha1.ApplicationSetCondition{ + { Status: v1alpha1.ApplicationSetConditionStatusTrue, Type: v1alpha1.ApplicationSetConditionResourcesUpToDate, }, @@ -75,12 +75,12 @@ func TestPrintApplicationSetTable(t *testing.T) { }, Spec: v1alpha1.ApplicationSetSpec{ Generators: []v1alpha1.ApplicationSetGenerator{ - v1alpha1.ApplicationSetGenerator{ + { Git: &v1alpha1.GitGenerator{ RepoURL: "https://github.com/argoproj/argo-cd.git", Revision: "head", Directories: []v1alpha1.GitDirectoryGeneratorItem{ - v1alpha1.GitDirectoryGeneratorItem{ + { Path: "applicationset/examples/git-generator-directory/cluster-addons/*", }, }, @@ -95,7 +95,7 @@ func TestPrintApplicationSetTable(t *testing.T) { }, Status: v1alpha1.ApplicationSetStatus{ Conditions: []v1alpha1.ApplicationSetCondition{ - v1alpha1.ApplicationSetCondition{ + { Status: v1alpha1.ApplicationSetConditionStatusTrue, Type: v1alpha1.ApplicationSetConditionResourcesUpToDate, }, @@ -118,12 +118,12 @@ func TestPrintAppSetSummaryTable(t *testing.T) { }, Spec: v1alpha1.ApplicationSetSpec{ Generators: []v1alpha1.ApplicationSetGenerator{ - v1alpha1.ApplicationSetGenerator{ + { Git: &v1alpha1.GitGenerator{ RepoURL: "https://github.com/argoproj/argo-cd.git", Revision: "head", Directories: []v1alpha1.GitDirectoryGeneratorItem{ - v1alpha1.GitDirectoryGeneratorItem{ + { Path: "applicationset/examples/git-generator-directory/cluster-addons/*", }, }, @@ -138,7 +138,7 @@ func TestPrintAppSetSummaryTable(t *testing.T) { }, Status: v1alpha1.ApplicationSetStatus{ Conditions: []v1alpha1.ApplicationSetCondition{ - v1alpha1.ApplicationSetCondition{ + { Status: v1alpha1.ApplicationSetConditionStatusTrue, Type: v1alpha1.ApplicationSetConditionResourcesUpToDate, }, diff --git a/resource_customizations/embed.go b/resource_customizations/embed.go index 251b12293efac..8a4d5316cd3df 100644 --- a/resource_customizations/embed.go +++ b/resource_customizations/embed.go @@ -5,5 +5,6 @@ import ( ) // Embedded contains embedded resource customization +// //go:embed * var Embedded embed.FS diff --git a/server/badge/badge.go b/server/badge/badge.go index f9ed158addd6f..a87ef1d2affb1 100644 --- a/server/badge/badge.go +++ b/server/badge/badge.go @@ -18,12 +18,12 @@ import ( "github.com/argoproj/argo-cd/v2/util/settings" ) -//NewHandler creates handler serving to do api/badge endpoint +// NewHandler creates handler serving to do api/badge endpoint func NewHandler(appClientset versioned.Interface, settingsMrg *settings.SettingsManager, namespace string) http.Handler { return &Handler{appClientset: appClientset, namespace: namespace, settingsMgr: settingsMrg} } -//Handler used to get application in order to access health/sync +// Handler used to get application in order to access health/sync type Handler struct { namespace string appClientset versioned.Interface @@ -62,8 +62,8 @@ func replaceFirstGroupSubMatch(re *regexp.Regexp, str string, repl string) strin return result + str[lastIndex:] } -//ServeHTTP returns badge with health and sync status for application -//(or an error badge if wrong query or application name is given) +// ServeHTTP returns badge with health and sync status for application +// (or an error badge if wrong query or application name is given) func (h *Handler) ServeHTTP(w http.ResponseWriter, r *http.Request) { health := healthutil.HealthStatusUnknown status := appv1.SyncStatusCodeUnknown diff --git a/server/logout/logout.go b/server/logout/logout.go index e2bfa81f28bfb..e49f815931596 100644 --- a/server/logout/logout.go +++ b/server/logout/logout.go @@ -19,7 +19,7 @@ import ( "github.com/argoproj/argo-cd/v2/util/settings" ) -//NewHandler creates handler serving to do api/logout endpoint +// NewHandler creates handler serving to do api/logout endpoint func NewHandler(appClientset versioned.Interface, settingsMrg *settings.SettingsManager, sessionMgr *session.SessionManager, rootPath, baseHRef, namespace string) *Handler { return &Handler{ appClientset: appClientset, diff --git a/test/e2e/jsonnet_test.go b/test/e2e/jsonnet_test.go index 7cc50d2bccab5..cad88f34a0048 100644 --- a/test/e2e/jsonnet_test.go +++ b/test/e2e/jsonnet_test.go @@ -102,7 +102,7 @@ func TestJsonnetExtVarEnv(t *testing.T) { }) } -//Jsonnet file located in nested sub directory uses import +// Jsonnet file located in nested sub directory uses import func TestJsonnetNestedDirWithImports(t *testing.T) { Given(t). Path("jsonnet-nested-dir-with-imports/apps"). diff --git a/test/e2e/notification_test.go b/test/e2e/notification_test.go index ce18f793a9afa..363cb87454a0f 100644 --- a/test/e2e/notification_test.go +++ b/test/e2e/notification_test.go @@ -15,7 +15,7 @@ func TestNotificationsListServices(t *testing.T) { SetParamInNotificationConfigMap("service.webhook.test", "url: https://test.com"). Then().Services(func(services *notification.ServiceList, err error) { assert.Nil(t, err) - assert.Equal(t, []*notification.Service{¬ification.Service{Name: pointer.String("test")}}, services.Items) + assert.Equal(t, []*notification.Service{{Name: pointer.String("test")}}, services.Items) }) } @@ -25,7 +25,7 @@ func TestNotificationsListTemplates(t *testing.T) { SetParamInNotificationConfigMap("template.app-created", "email:\n subject: Application {{.app.metadata.name}} has been created.\nmessage: Application {{.app.metadata.name}} has been created.\nteams:\n title: Application {{.app.metadata.name}} has been created.\n"). Then().Templates(func(templates *notification.TemplateList, err error) { assert.Nil(t, err) - assert.Equal(t, []*notification.Template{¬ification.Template{Name: pointer.String("app-created")}}, templates.Items) + assert.Equal(t, []*notification.Template{{Name: pointer.String("app-created")}}, templates.Items) }) } @@ -35,6 +35,6 @@ func TestNotificationsListTriggers(t *testing.T) { SetParamInNotificationConfigMap("trigger.on-created", "- description: Application is created.\n oncePer: app.metadata.name\n send:\n - app-created\n when: \"true\"\n"). Then().Triggers(func(triggers *notification.TriggerList, err error) { assert.Nil(t, err) - assert.Equal(t, []*notification.Trigger{¬ification.Trigger{Name: pointer.String("on-created")}}, triggers.Items) + assert.Equal(t, []*notification.Trigger{{Name: pointer.String("on-created")}}, triggers.Items) }) } diff --git a/test/e2e/selective_sync_test.go b/test/e2e/selective_sync_test.go index 1738264c509fc..491914be55184 100644 --- a/test/e2e/selective_sync_test.go +++ b/test/e2e/selective_sync_test.go @@ -80,7 +80,7 @@ func TestSelectiveSyncWithoutNamespace(t *testing.T) { Expect(ResourceSyncStatusWithNamespaceIs("Deployment", "guestbook-ui", fixture.DeploymentNamespace(), SyncStatusCodeSynced)) } -//In selectedResource to sync, namespace is provided +// In selectedResource to sync, namespace is provided func TestSelectiveSyncWithNamespace(t *testing.T) { selectedResourceNamespace := getNewNamespace(t) defer func() { diff --git a/ui/embed.go b/ui/embed.go index 665621a9c12fd..8f9c2774fbbca 100644 --- a/ui/embed.go +++ b/ui/embed.go @@ -3,5 +3,6 @@ package ui import "embed" // Embedded contains embedded UI resources +// //go:embed dist/app var Embedded embed.FS diff --git a/util/db/certificate.go b/util/db/certificate.go index 5ca93a3da40a5..4a0b56540b1c5 100644 --- a/util/db/certificate.go +++ b/util/db/certificate.go @@ -52,10 +52,9 @@ type CertificateListSelector struct { // the certificates, and only returns the metadata including CertInfo field. // // The CertInfo field in the returned entries will contain the following data: -// - For SSH keys, the SHA256 fingerprint of the key as string, prepended by -// the string "SHA256:" -// - For TLS certs, the Subject of the X509 cert as a string in DN notation -// +// - For SSH keys, the SHA256 fingerprint of the key as string, prepended by +// the string "SHA256:" +// - For TLS certs, the Subject of the X509 cert as a string in DN notation func (db *db) ListRepoCertificates(ctx context.Context, selector *CertificateListSelector) (*appsv1.RepositoryCertificateList, error) { // selector may be given as nil, but we need at least an empty data structure diff --git a/util/db/helmrepository.go b/util/db/helmrepository.go index f369ef3da6bc5..3755b10f974f5 100644 --- a/util/db/helmrepository.go +++ b/util/db/helmrepository.go @@ -35,10 +35,10 @@ func (db *db) getHelmRepo(repoURL string, helmRepositories []settings.HelmRepoCr Name: repoInfo.Name, } err := db.unmarshalFromSecretsStr(map[*SecretMaperValidation]*v1.SecretKeySelector{ - &SecretMaperValidation{Dest: &repo.Username, Transform: StripCRLFCharacter}: repoInfo.UsernameSecret, - &SecretMaperValidation{Dest: &repo.Password, Transform: StripCRLFCharacter}: repoInfo.PasswordSecret, - &SecretMaperValidation{Dest: &repo.TLSClientCertData, Transform: StripCRLFCharacter}: repoInfo.CertSecret, - &SecretMaperValidation{Dest: &repo.TLSClientCertKey, Transform: StripCRLFCharacter}: repoInfo.KeySecret, + {Dest: &repo.Username, Transform: StripCRLFCharacter}: repoInfo.UsernameSecret, + {Dest: &repo.Password, Transform: StripCRLFCharacter}: repoInfo.PasswordSecret, + {Dest: &repo.TLSClientCertData, Transform: StripCRLFCharacter}: repoInfo.CertSecret, + {Dest: &repo.TLSClientCertKey, Transform: StripCRLFCharacter}: repoInfo.KeySecret, }, make(map[string]*v1.Secret)) return repo, err } diff --git a/util/db/repository_legacy.go b/util/db/repository_legacy.go index 814ff77d73d55..0aee0cd336fa8 100644 --- a/util/db/repository_legacy.go +++ b/util/db/repository_legacy.go @@ -387,13 +387,13 @@ func (l *legacyRepositoryBackend) credentialsToRepository(repoInfo settings.Repo Proxy: repoInfo.Proxy, } err := l.db.unmarshalFromSecretsStr(map[*SecretMaperValidation]*apiv1.SecretKeySelector{ - &SecretMaperValidation{Dest: &repo.Username, Transform: StripCRLFCharacter}: repoInfo.UsernameSecret, - &SecretMaperValidation{Dest: &repo.Password, Transform: StripCRLFCharacter}: repoInfo.PasswordSecret, - &SecretMaperValidation{Dest: &repo.SSHPrivateKey, Transform: StripCRLFCharacter}: repoInfo.SSHPrivateKeySecret, - &SecretMaperValidation{Dest: &repo.TLSClientCertData, Transform: StripCRLFCharacter}: repoInfo.TLSClientCertDataSecret, - &SecretMaperValidation{Dest: &repo.TLSClientCertKey, Transform: StripCRLFCharacter}: repoInfo.TLSClientCertKeySecret, - &SecretMaperValidation{Dest: &repo.GithubAppPrivateKey, Transform: StripCRLFCharacter}: repoInfo.GithubAppPrivateKeySecret, - &SecretMaperValidation{Dest: &repo.GCPServiceAccountKey, Transform: StripCRLFCharacter}: repoInfo.GCPServiceAccountKey, + {Dest: &repo.Username, Transform: StripCRLFCharacter}: repoInfo.UsernameSecret, + {Dest: &repo.Password, Transform: StripCRLFCharacter}: repoInfo.PasswordSecret, + {Dest: &repo.SSHPrivateKey, Transform: StripCRLFCharacter}: repoInfo.SSHPrivateKeySecret, + {Dest: &repo.TLSClientCertData, Transform: StripCRLFCharacter}: repoInfo.TLSClientCertDataSecret, + {Dest: &repo.TLSClientCertKey, Transform: StripCRLFCharacter}: repoInfo.TLSClientCertKeySecret, + {Dest: &repo.GithubAppPrivateKey, Transform: StripCRLFCharacter}: repoInfo.GithubAppPrivateKeySecret, + {Dest: &repo.GCPServiceAccountKey, Transform: StripCRLFCharacter}: repoInfo.GCPServiceAccountKey, }, make(map[string]*apiv1.Secret)) return repo, err } @@ -407,13 +407,13 @@ func (l *legacyRepositoryBackend) credentialsToRepositoryCredentials(repoInfo se EnableOCI: repoInfo.EnableOCI, } err := l.db.unmarshalFromSecretsStr(map[*SecretMaperValidation]*apiv1.SecretKeySelector{ - &SecretMaperValidation{Dest: &creds.Username}: repoInfo.UsernameSecret, - &SecretMaperValidation{Dest: &creds.Password}: repoInfo.PasswordSecret, - &SecretMaperValidation{Dest: &creds.SSHPrivateKey}: repoInfo.SSHPrivateKeySecret, - &SecretMaperValidation{Dest: &creds.TLSClientCertData}: repoInfo.TLSClientCertDataSecret, - &SecretMaperValidation{Dest: &creds.TLSClientCertKey}: repoInfo.TLSClientCertKeySecret, - &SecretMaperValidation{Dest: &creds.GithubAppPrivateKey}: repoInfo.GithubAppPrivateKeySecret, - &SecretMaperValidation{Dest: &creds.GCPServiceAccountKey}: repoInfo.GCPServiceAccountKey, + {Dest: &creds.Username}: repoInfo.UsernameSecret, + {Dest: &creds.Password}: repoInfo.PasswordSecret, + {Dest: &creds.SSHPrivateKey}: repoInfo.SSHPrivateKeySecret, + {Dest: &creds.TLSClientCertData}: repoInfo.TLSClientCertDataSecret, + {Dest: &creds.TLSClientCertKey}: repoInfo.TLSClientCertKeySecret, + {Dest: &creds.GithubAppPrivateKey}: repoInfo.GithubAppPrivateKeySecret, + {Dest: &creds.GCPServiceAccountKey}: repoInfo.GCPServiceAccountKey, }, make(map[string]*apiv1.Secret)) return creds, err } diff --git a/util/helm/client.go b/util/helm/client.go index 8fa3f6c0d24d8..cfd9ae84dc419 100644 --- a/util/helm/client.go +++ b/util/helm/client.go @@ -302,8 +302,8 @@ func (c *nativeHelmChart) loadRepoIndex() ([]byte, error) { } tr := &http.Transport{ - Proxy: proxy.GetCallback(c.proxy), - TLSClientConfig: tlsConf, + Proxy: proxy.GetCallback(c.proxy), + TLSClientConfig: tlsConf, DisableKeepAlives: true, } client := http.Client{Transport: tr} @@ -411,8 +411,8 @@ func (c *nativeHelmChart) GetTags(chart string, noCache bool) (*TagsList, error) return nil, fmt.Errorf("failed setup tlsConfig: %v", err) } client := &http.Client{Transport: &http.Transport{ - Proxy: proxy.GetCallback(c.proxy), - TLSClientConfig: tlsConf, + Proxy: proxy.GetCallback(c.proxy), + TLSClientConfig: tlsConf, DisableKeepAlives: true, }} repo.Client = &auth.Client{ diff --git a/util/helm/index_test.go b/util/helm/index_test.go index dd7fc0b8bfa06..937733db20f21 100644 --- a/util/helm/index_test.go +++ b/util/helm/index_test.go @@ -9,7 +9,7 @@ import ( var index = Index{ Entries: map[string]Entries{ - "argo-cd": { + "argo-cd": { {Version: "~0.7.3"}, {Version: "0.7.2"}, {Version: "0.7.1"}, diff --git a/util/io/files/util.go b/util/io/files/util.go index 6bbcaa751d395..741f224c3c839 100644 --- a/util/io/files/util.go +++ b/util/io/files/util.go @@ -20,19 +20,22 @@ var RelativeOutOfBoundErr = errors.New("full path does not contain base path") // does not match (example 2). // // Example 1: -// fullPath: /home/test/app/readme.md -// basePath: /home/test -// return: app/readme.md +// +// fullPath: /home/test/app/readme.md +// basePath: /home/test +// return: app/readme.md // // Example 2: -// fullPath: /home/test/app/readme.md -// basePath: /somewhere/else -// return: "", RelativeOutOfBoundErr +// +// fullPath: /home/test/app/readme.md +// basePath: /somewhere/else +// return: "", RelativeOutOfBoundErr // // Example 3: -// fullPath: /home/test/app/readme.md -// basePath: /home/test/app/readme.md -// return: . +// +// fullPath: /home/test/app/readme.md +// basePath: /home/test/app/readme.md +// return: . func RelativePath(fullPath, basePath string) (string, error) { fp := filepath.Clean(fullPath) if !strings.HasPrefix(fp, filepath.Clean(basePath)) { diff --git a/util/settings/resources_filter.go b/util/settings/resources_filter.go index 86f95cbfc7d63..7e656eabba8aa 100644 --- a/util/settings/resources_filter.go +++ b/util/settings/resources_filter.go @@ -62,7 +62,6 @@ func (rf *ResourcesFilter) isExcludedResource(apiGroup, kind, cluster string) bo // +-------------+-------------+-------------+ // | Present | Present | Not Allowed | // +-------------+-------------+-------------+ -// func (rf *ResourcesFilter) IsExcludedResource(apiGroup, kind, cluster string) bool { // if excluded, do not allow if rf.isExcludedResource(apiGroup, kind, cluster) {