diff --git a/.golangci.yaml b/.golangci.yaml
index 273b4ac84e..10f571c5b7 100644
--- a/.golangci.yaml
+++ b/.golangci.yaml
@@ -145,16 +145,19 @@ linters:
strconcat: true
revive:
+ enable-all-rules: false
+ enable-default-rules: true
+ max-open-files: 2048
# https://github.com/mgechev/revive/blob/master/RULES_DESCRIPTIONS.md
rules:
- - name: bool-literal-in-expr
-
- name: blank-imports
disabled: true
+ - name: bool-literal-in-expr
+
- name: context-as-argument
arguments:
- - allowTypesBefore: '*testing.T,testing.TB'
+ - allow-types-before: '*testing.T,testing.TB'
- name: context-keys-type
disabled: true
@@ -166,14 +169,11 @@ linters:
- name: early-return
arguments:
- - preserveScope
+ - preserve-scope
- name: empty-block
disabled: true
- - name: error-naming
- disabled: true
-
- name: error-return
- name: error-strings
@@ -181,6 +181,9 @@ linters:
- name: errorf
+ - name: exported
+ disabled: true
+
- name: identical-branches
- name: if-return
@@ -189,7 +192,7 @@ linters:
- name: indent-error-flow
arguments:
- - preserveScope
+ - preserve-scope
- name: modifies-parameter
@@ -206,7 +209,7 @@ linters:
- name: superfluous-else
arguments:
- - preserveScope
+ - preserve-scope
- name: time-equal
@@ -216,6 +219,8 @@ linters:
- name: unexported-return
disabled: true
+ - name: unnecessary-format
+
- name: unnecessary-stmt
- name: unreachable-code
@@ -232,8 +237,8 @@ linters:
arguments:
- - ID
- - VM
- - - skipPackageNameChecks: true
- upperCaseConst: true
+ - - skip-initialism-name-checks: true
+ upper-case-const: true
staticcheck:
checks:
@@ -255,7 +260,4 @@ linters:
usetesting:
os-mkdir-temp: false
-output:
- show-stats: false
-
version: "2"
diff --git a/cmd/argocd/commands/account.go b/cmd/argocd/commands/account.go
index 495cfb5765..048343020f 100644
--- a/cmd/argocd/commands/account.go
+++ b/cmd/argocd/commands/account.go
@@ -127,7 +127,7 @@ has appropriate RBAC permissions to change other accounts.
_, err := usrIf.UpdatePassword(ctx, &updatePasswordRequest)
errors.CheckError(err)
- fmt.Printf("Password updated\n")
+ fmt.Print("Password updated\n")
if account == "" || account == userInfo.Username {
// Get a new JWT token after updating the password
@@ -254,7 +254,7 @@ func printAccountNames(accounts []*accountpkg.Account) {
func printAccountsTable(items []*accountpkg.Account) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- fmt.Fprintf(w, "NAME\tENABLED\tCAPABILITIES\n")
+ fmt.Fprint(w, "NAME\tENABLED\tCAPABILITIES\n")
for _, a := range items {
fmt.Fprintf(w, "%s\t%v\t%s\n", a.Name, a.Enabled, strings.Join(a.Capabilities, ", "))
}
@@ -356,7 +356,7 @@ func printAccountDetails(acc *accountpkg.Account) {
fmt.Println("NONE")
} else {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- fmt.Fprintf(w, "ID\tISSUED AT\tEXPIRING AT\n")
+ fmt.Fprint(w, "ID\tISSUED AT\tEXPIRING AT\n")
for _, t := range acc.Tokens {
expiresAtFormatted := "never"
if t.ExpiresAt > 0 {
diff --git a/cmd/argocd/commands/admin/cluster.go b/cmd/argocd/commands/admin/cluster.go
index 68cb989351..a5754f5b0d 100644
--- a/cmd/argocd/commands/admin/cluster.go
+++ b/cmd/argocd/commands/admin/cluster.go
@@ -240,7 +240,7 @@ func printStatsSummary(clusters []ClusterWithInfo) {
avgResourcesByShard := totalResourcesCount / int64(len(resourcesCountByShard))
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- _, _ = fmt.Fprintf(w, "SHARD\tRESOURCES COUNT\n")
+ _, _ = fmt.Fprint(w, "SHARD\tRESOURCES COUNT\n")
for shard := 0; shard < len(resourcesCountByShard); shard++ {
cnt := resourcesCountByShard[shard]
percent := (float64(cnt) / float64(avgResourcesByShard)) * 100.0
@@ -318,7 +318,7 @@ func NewClusterNamespacesCommand() *cobra.Command {
err := runClusterNamespacesCommand(ctx, clientConfig, func(_ *versioned.Clientset, _ db.ArgoDB, clusters map[string][]string) error {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- _, _ = fmt.Fprintf(w, "CLUSTER\tNAMESPACES\n")
+ _, _ = fmt.Fprint(w, "CLUSTER\tNAMESPACES\n")
for cluster, namespaces := range clusters {
// print shortest namespace names first
@@ -495,7 +495,7 @@ argocd admin cluster stats target-cluster`,
errors.CheckError(err)
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- _, _ = fmt.Fprintf(w, "SERVER\tSHARD\tCONNECTION\tNAMESPACES COUNT\tAPPS COUNT\tRESOURCES COUNT\n")
+ _, _ = fmt.Fprint(w, "SERVER\tSHARD\tCONNECTION\tNAMESPACES COUNT\tAPPS COUNT\tRESOURCES COUNT\n")
for _, cluster := range clusters {
_, _ = fmt.Fprintf(w, "%s\t%d\t%s\t%d\t%d\t%d\n", cluster.Server, cluster.Shard, cluster.Info.ConnectionState.Status, len(cluster.Namespaces), cluster.Info.ApplicationsCount, cluster.Info.CacheInfo.ResourcesCount)
}
diff --git a/cmd/argocd/commands/admin/settings.go b/cmd/argocd/commands/admin/settings.go
index a3228eacc6..a8a763670e 100644
--- a/cmd/argocd/commands/admin/settings.go
+++ b/cmd/argocd/commands/admin/settings.go
@@ -313,7 +313,7 @@ argocd admin settings validate --group accounts --group plugins --load-cluster-s
_, _ = fmt.Fprintf(os.Stdout, "%s\n", logs)
}
if i != len(groups)-1 {
- _, _ = fmt.Fprintf(os.Stdout, "\n")
+ _, _ = fmt.Fprint(os.Stdout, "\n")
}
}
},
@@ -429,7 +429,7 @@ argocd admin settings resource-overrides ignore-differences ./deploy.yaml --argo
return
}
- _, _ = fmt.Printf("Following fields are ignored:\n\n")
+ _, _ = fmt.Print("Following fields are ignored:\n\n")
_ = cli.PrintDiff(res.GetName(), &res, normalizedRes)
})
},
@@ -476,7 +476,7 @@ argocd admin settings resource-overrides ignore-resource-updates ./deploy.yaml -
return
}
- _, _ = fmt.Printf("Following fields are ignored:\n\n")
+ _, _ = fmt.Print("Following fields are ignored:\n\n")
_ = cli.PrintDiff(res.GetName(), &res, normalizedRes)
})
},
@@ -551,7 +551,7 @@ argocd admin settings resource-overrides action list /tmp/deploy.yaml --argocd-c
})
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- _, _ = fmt.Fprintf(w, "NAME\tDISABLED\n")
+ _, _ = fmt.Fprint(w, "NAME\tDISABLED\n")
for _, action := range availableActions {
_, _ = fmt.Fprintf(w, "%s\t%s\n", action.Name, strconv.FormatBool(action.Disabled))
}
@@ -622,7 +622,7 @@ argocd admin settings resource-overrides action /tmp/deploy.yaml restart --argoc
return
}
- _, _ = fmt.Printf("Following fields have been changed:\n\n")
+ _, _ = fmt.Print("Following fields have been changed:\n\n")
_ = cli.PrintDiff(res.GetName(), &res, result)
case lua.CreateOperation:
yamlBytes, err := yaml.Marshal(impactedResource.UnstructuredObj)
diff --git a/cmd/argocd/commands/admin/settings_rbac.go b/cmd/argocd/commands/admin/settings_rbac.go
index 86dc6f9171..e125742442 100644
--- a/cmd/argocd/commands/admin/settings_rbac.go
+++ b/cmd/argocd/commands/admin/settings_rbac.go
@@ -182,7 +182,7 @@ argocd admin settings rbac can someuser create application 'default/app' --defau
// Exactly one of --namespace or --policy-file must be given.
if (!nsOverride && policyFile == "") || (nsOverride && policyFile != "") {
c.HelpFunc()(c, args)
- log.Fatalf("please provide exactly one of --policy-file or --namespace")
+ log.Fatal("please provide exactly one of --policy-file or --namespace")
}
restConfig, err := clientConfig.ClientConfig()
@@ -264,12 +264,12 @@ argocd admin settings rbac validate --namespace argocd
if len(args) > 0 {
c.HelpFunc()(c, args)
- log.Fatalf("too many arguments")
+ log.Fatal("too many arguments")
}
if (namespace == "" && policyFile == "") || (namespace != "" && policyFile != "") {
c.HelpFunc()(c, args)
- log.Fatalf("please provide exactly one of --policy-file or --namespace")
+ log.Fatal("please provide exactly one of --policy-file or --namespace")
}
restConfig, err := clientConfig.ClientConfig()
@@ -284,13 +284,13 @@ argocd admin settings rbac validate --namespace argocd
userPolicy, _, _ := getPolicy(ctx, policyFile, realClientset, namespace)
if userPolicy != "" {
if err := rbac.ValidatePolicy(userPolicy); err == nil {
- fmt.Printf("Policy is valid.\n")
+ fmt.Print("Policy is valid.\n")
os.Exit(0)
}
fmt.Printf("Policy is invalid: %v\n", err)
os.Exit(1)
}
- log.Fatalf("Policy is empty or could not be loaded.")
+ log.Fatal("Policy is empty or could not be loaded.")
},
}
clientConfig = cli.AddKubectlFlagsToCmd(command)
diff --git a/cmd/argocd/commands/app.go b/cmd/argocd/commands/app.go
index 612f42a1fe..215aaef175 100644
--- a/cmd/argocd/commands/app.go
+++ b/cmd/argocd/commands/app.go
@@ -757,7 +757,7 @@ func printAppSourceDetails(appSrc *argoappv1.ApplicationSource) {
}
func printAppConditions(w io.Writer, app *argoappv1.Application) {
- _, _ = fmt.Fprintf(w, "CONDITION\tMESSAGE\tLAST TRANSITION\n")
+ _, _ = fmt.Fprint(w, "CONDITION\tMESSAGE\tLAST TRANSITION\n")
for _, item := range app.Status.Conditions {
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\n", item.Type, item.Message, item.LastTransitionTime)
}
@@ -829,7 +829,7 @@ func printHelmParams(helm *argoappv1.ApplicationSourceHelm) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
if helm != nil {
fmt.Println()
- _, _ = fmt.Fprintf(w, "NAME\tVALUE\n")
+ _, _ = fmt.Fprint(w, "NAME\tVALUE\n")
for _, p := range helm.Parameters {
_, _ = fmt.Fprintf(w, "%s\t%s\n", p.Name, truncateString(p.Value, paramLenLimit))
}
@@ -1365,7 +1365,7 @@ func NewApplicationDiffCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
serverSideDiff = hasServerSideDiffAnnotation
} else if serverSideDiff && !hasServerSideDiffAnnotation {
// Flag explicitly set to true, but app annotation is not set
- fmt.Fprintf(os.Stderr, "Warning: Application does not have ServerSideDiff=true annotation.\n")
+ fmt.Fprint(os.Stderr, "Warning: Application does not have ServerSideDiff=true annotation.\n")
}
// Server side diff with local requires server side generate to be set as there will be a mismatch with client-generated manifests.
@@ -1418,7 +1418,7 @@ func NewApplicationDiffCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
diffOption.serversideRes = res
} else {
- fmt.Fprintf(os.Stderr, "Warning: local diff without --server-side-generate is deprecated and does not work with plugins. Server-side generation will be the default in v2.7.")
+ fmt.Fprint(os.Stderr, "Warning: local diff without --server-side-generate is deprecated and does not work with plugins. Server-side generation will be the default in v2.7.")
conn, clusterIf := clientset.NewClusterClientOrDie()
defer utilio.Close(conn)
cluster, err := clusterIf.Get(ctx, &clusterpkg.ClusterQuery{Name: app.Spec.Destination.Name, Server: app.Spec.Destination.Server})
@@ -2104,7 +2104,7 @@ func NewApplicationWaitCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
// printAppResources prints the resources of an application in a tabwriter table
func printAppResources(w io.Writer, app *argoappv1.Application) {
- _, _ = fmt.Fprintf(w, "GROUP\tKIND\tNAMESPACE\tNAME\tSTATUS\tHEALTH\tHOOK\tMESSAGE\n")
+ _, _ = fmt.Fprint(w, "GROUP\tKIND\tNAMESPACE\tNAME\tSTATUS\tHEALTH\tHOOK\tMESSAGE\n")
for _, res := range getResourceStates(app, nil) {
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\t%s\t%s\t%s\n", res.Group, res.Kind, res.Namespace, res.Name, res.Status, res.Health, res.Hook, res.Message)
}
@@ -2112,7 +2112,7 @@ func printAppResources(w io.Writer, app *argoappv1.Application) {
func printTreeView(nodeMapping map[string]argoappv1.ResourceNode, parentChildMapping map[string][]string, parentNodes map[string]struct{}, mapNodeNameToResourceState map[string]*resourceState) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- _, _ = fmt.Fprintf(w, "KIND/NAME\tSTATUS\tHEALTH\tMESSAGE\n")
+ _, _ = fmt.Fprint(w, "KIND/NAME\tSTATUS\tHEALTH\tMESSAGE\n")
for uid := range parentNodes {
treeViewAppGet("", nodeMapping, parentChildMapping, nodeMapping[uid], mapNodeNameToResourceState, w)
}
@@ -2121,7 +2121,7 @@ func printTreeView(nodeMapping map[string]argoappv1.ResourceNode, parentChildMap
func printTreeViewDetailed(nodeMapping map[string]argoappv1.ResourceNode, parentChildMapping map[string][]string, parentNodes map[string]struct{}, mapNodeNameToResourceState map[string]*resourceState) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- fmt.Fprintf(w, "KIND/NAME\tSTATUS\tHEALTH\tAGE\tMESSAGE\tREASON\n")
+ fmt.Fprint(w, "KIND/NAME\tSTATUS\tHEALTH\tAGE\tMESSAGE\tREASON\n")
for uid := range parentNodes {
detailedTreeViewAppGet("", nodeMapping, parentChildMapping, nodeMapping[uid], mapNodeNameToResourceState, w)
}
@@ -2453,7 +2453,7 @@ func NewApplicationSyncCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
foundDiffs = findAndPrintDiff(ctx, app, proj.Project, resources, argoSettings, diffOption, ignoreNormalizerOpts, serverSideDiff, appIf, appName, appNs, serverSideDiffConcurrency, serverSideDiffMaxBatchKB)
if !foundDiffs {
- fmt.Printf("====== No Differences found ======\n")
+ fmt.Print("====== No Differences found ======\n")
// if no differences found, then no need to sync
return
}
@@ -2973,7 +2973,7 @@ func setParameterOverrides(app *argoappv1.Application, parameters []string, sour
source.Helm.AddParameter(*newParam)
}
default:
- log.Fatalf("Parameters can only be set against Helm applications")
+ log.Fatal("Parameters can only be set against Helm applications")
}
}
@@ -3028,13 +3028,13 @@ func printApplicationHistoryTable(revHistory []argoappv1.RevisionHistory) {
}
for i, key := range varHistoryKeys {
_, _ = fmt.Fprintf(w, "SOURCE\t%s\n", key)
- _, _ = fmt.Fprintf(w, "ID\tDATE\tREVISION\n")
+ _, _ = fmt.Fprint(w, "ID\tDATE\tREVISION\n")
for _, history := range varHistory[key] {
_, _ = fmt.Fprintf(w, "%d\t%s\t%s\n", history.id, history.date, history.revision)
}
// Add a newline if it's not the last iteration
if i < len(varHistoryKeys)-1 {
- _, _ = fmt.Fprintf(w, "\n")
+ _, _ = fmt.Fprint(w, "\n")
}
}
_ = w.Flush()
diff --git a/cmd/argocd/commands/app_actions.go b/cmd/argocd/commands/app_actions.go
index 780c8a6c4b..598ac1fafd 100644
--- a/cmd/argocd/commands/app_actions.go
+++ b/cmd/argocd/commands/app_actions.go
@@ -124,7 +124,7 @@ func NewApplicationResourceActionsListCommand(clientOpts *argocdclient.ClientOpt
fmt.Println(string(jsonBytes))
case "":
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- fmt.Fprintf(w, "GROUP\tKIND\tNAME\tACTION\tDISABLED\n")
+ fmt.Fprint(w, "GROUP\tKIND\tNAME\tACTION\tDISABLED\n")
for _, action := range availableActions {
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%s\n", action.Group, action.Kind, action.Name, action.Action, strconv.FormatBool(action.Disabled))
}
diff --git a/cmd/argocd/commands/app_resources.go b/cmd/argocd/commands/app_resources.go
index 1eb796452b..ee27aa43e1 100644
--- a/cmd/argocd/commands/app_resources.go
+++ b/cmd/argocd/commands/app_resources.go
@@ -217,9 +217,9 @@ func reconstructObject(extracted []any, fields []string, depth int) map[string]a
func printManifests(objs *[]unstructured.Unstructured, filteredFields bool, showName bool, output string) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
if showName {
- fmt.Fprintf(w, "FIELD\tRESOURCE NAME\tVALUE\n")
+ fmt.Fprint(w, "FIELD\tRESOURCE NAME\tVALUE\n")
} else {
- fmt.Fprintf(w, "FIELD\tVALUE\n")
+ fmt.Fprint(w, "FIELD\tVALUE\n")
}
for i, o := range *objs {
@@ -479,7 +479,7 @@ func printResources(listAll bool, orphaned bool, appResourceTree *v1alpha1.Appli
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
switch output {
case "tree=detailed":
- fmt.Fprintf(w, "GROUP\tKIND\tNAMESPACE\tNAME\tORPHANED\tAGE\tHEALTH\tREASON\n")
+ fmt.Fprint(w, "GROUP\tKIND\tNAMESPACE\tNAME\tORPHANED\tAGE\tHEALTH\tREASON\n")
if !orphaned || listAll {
mapUIDToNode, mapParentToChild, parentNode := parentChildInfo(appResourceTree.Nodes)
@@ -491,7 +491,7 @@ func printResources(listAll bool, orphaned bool, appResourceTree *v1alpha1.Appli
printDetailedTreeViewAppResourcesOrphaned(mapUIDToNode, mapParentToChild, parentNode, w)
}
case "tree":
- fmt.Fprintf(w, "GROUP\tKIND\tNAMESPACE\tNAME\tORPHANED\n")
+ fmt.Fprint(w, "GROUP\tKIND\tNAMESPACE\tNAME\tORPHANED\n")
if !orphaned || listAll {
mapUIDToNode, mapParentToChild, parentNode := parentChildInfo(appResourceTree.Nodes)
diff --git a/cmd/argocd/commands/applicationset.go b/cmd/argocd/commands/applicationset.go
index 8d71129ec4..86a98e2a80 100644
--- a/cmd/argocd/commands/applicationset.go
+++ b/cmd/argocd/commands/applicationset.go
@@ -162,7 +162,7 @@ func NewApplicationSetCreateCommand(clientOpts *argocdclient.ClientOptions) *cob
errors.CheckError(err)
if len(appsets) == 0 {
- fmt.Printf("No ApplicationSets found while parsing the input file")
+ fmt.Print("No ApplicationSets found while parsing the input file")
os.Exit(1)
}
@@ -271,7 +271,7 @@ func NewApplicationSetGenerateCommand(clientOpts *argocdclient.ClientOptions) *c
errors.CheckError(err)
if len(appsets) != 1 {
- fmt.Printf("Input file must contain one ApplicationSet")
+ fmt.Print("Input file must contain one ApplicationSet")
os.Exit(1)
}
appset := appsets[0]
@@ -544,7 +544,7 @@ func printAppSetSummaryTable(appSet *arogappsetv1.ApplicationSet) {
}
func printAppSetConditions(w io.Writer, appSet *arogappsetv1.ApplicationSet) {
- _, _ = fmt.Fprintf(w, "CONDITION\tSTATUS\tMESSAGE\tLAST TRANSITION\n")
+ _, _ = fmt.Fprint(w, "CONDITION\tSTATUS\tMESSAGE\tLAST TRANSITION\n")
for _, item := range appSet.Status.Conditions {
_, _ = fmt.Fprintf(w, "%s\t%s\t%s\t%s\n", item.Type, item.Status, item.Message, item.LastTransitionTime)
}
diff --git a/cmd/argocd/commands/cert.go b/cmd/argocd/commands/cert.go
index 8666c059e1..4e02507f70 100644
--- a/cmd/argocd/commands/cert.go
+++ b/cmd/argocd/commands/cert.go
@@ -352,7 +352,7 @@ func NewCertListCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
// Print table of certificate info
func printCertTable(certs []appsv1.RepositoryCertificate, sortOrder string) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- fmt.Fprintf(w, "HOSTNAME\tTYPE\tSUBTYPE\tINFO\n")
+ fmt.Fprint(w, "HOSTNAME\tTYPE\tSUBTYPE\tINFO\n")
switch sortOrder {
case "hostname", "":
diff --git a/cmd/argocd/commands/cluster.go b/cmd/argocd/commands/cluster.go
index 7b5ade4d89..0ee8d8123a 100644
--- a/cmd/argocd/commands/cluster.go
+++ b/cmd/argocd/commands/cluster.go
@@ -377,15 +377,15 @@ func formatNamespaces(cluster argoappv1.Cluster) string {
func printClusterDetails(clusters []argoappv1.Cluster) {
for _, cluster := range clusters {
- fmt.Printf("Cluster information\n\n")
+ fmt.Print("Cluster information\n\n")
fmt.Printf(" Server URL: %s\n", cluster.Server)
fmt.Printf(" Server Name: %s\n", strWithDefault(cluster.Name, "-"))
fmt.Printf(" Server Version: %s\n", cluster.Info.ServerVersion)
fmt.Printf(" Namespaces: %s\n", formatNamespaces(cluster))
- fmt.Printf("\nTLS configuration\n\n")
+ fmt.Print("\nTLS configuration\n\n")
fmt.Printf(" Client cert: %v\n", len(cluster.Config.CertData) != 0)
fmt.Printf(" Cert validation: %v\n", !cluster.Config.Insecure)
- fmt.Printf("\nAuthentication\n\n")
+ fmt.Print("\nAuthentication\n\n")
fmt.Printf(" Basic authentication: %v\n", cluster.Config.Username != "")
fmt.Printf(" oAuth authentication: %v\n", cluster.Config.BearerToken != "")
fmt.Printf(" AWS authentication: %v\n", cluster.Config.AWSAuthConfig != nil)
@@ -468,7 +468,7 @@ argocd cluster rm cluster-name`,
// Print table of cluster information
func printClusterTable(clusters []argoappv1.Cluster) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- _, _ = fmt.Fprintf(w, "SERVER\tNAME\tVERSION\tSTATUS\tMESSAGE\tPROJECT\n")
+ _, _ = fmt.Fprint(w, "SERVER\tNAME\tVERSION\tSTATUS\tMESSAGE\tPROJECT\n")
for _, c := range clusters {
server := c.Server
if len(c.Namespaces) > 0 {
diff --git a/cmd/argocd/commands/gpg.go b/cmd/argocd/commands/gpg.go
index 3150c5cfe8..5567a5bd6d 100644
--- a/cmd/argocd/commands/gpg.go
+++ b/cmd/argocd/commands/gpg.go
@@ -151,7 +151,7 @@ func NewGPGAddCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
if len(resp.Skipped) > 0 {
fmt.Printf(", and %d key(s) were skipped because they exist already", len(resp.Skipped))
}
- fmt.Printf(".\n")
+ fmt.Print(".\n")
},
}
command.Flags().StringVarP(&fromFile, "from", "f", "", "Path to the file that contains the GPG public key to import")
@@ -192,7 +192,7 @@ func NewGPGDeleteCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command
// Print table of certificate info
func printKeyTable(keys []appsv1.GnuPGPublicKey) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- fmt.Fprintf(w, "KEYID\tTYPE\tIDENTITY\n")
+ fmt.Fprint(w, "KEYID\tTYPE\tIDENTITY\n")
for _, k := range keys {
fmt.Fprintf(w, "%s\t%s\t%s\n", k.KeyID, strings.ToUpper(k.SubType), k.Owner)
diff --git a/cmd/argocd/commands/login.go b/cmd/argocd/commands/login.go
index eb40c78523..83d810bd29 100644
--- a/cmd/argocd/commands/login.go
+++ b/cmd/argocd/commands/login.go
@@ -274,7 +274,7 @@ func oauth2Login(
// flow where the id_token is contained in a URL fragment, making it inaccessible to be
// read from the request. This javascript will redirect the browser to send the
// fragments as query parameters so our callback handler can read and return token.
- fmt.Fprintf(w, ``)
+ fmt.Fprint(w, ``)
return
}
@@ -351,7 +351,7 @@ func oauth2Login(
if errMsg != "" {
log.Fatal(errMsg)
}
- fmt.Printf("Authentication successful\n")
+ fmt.Print("Authentication successful\n")
ctx, cancel := context.WithTimeout(ctx, 1*time.Second)
defer cancel()
_ = srv.Shutdown(ctx)
@@ -375,7 +375,7 @@ func passwordLogin(ctx context.Context, acdClient argocdclient.Client, username,
func ssoAuthFlow(url string, ssoLaunchBrowser bool) {
if ssoLaunchBrowser {
- fmt.Printf("Opening system default browser for authentication\n")
+ fmt.Print("Opening system default browser for authentication\n")
err := open.Start(url)
errors.CheckError(err)
} else {
diff --git a/cmd/argocd/commands/logout.go b/cmd/argocd/commands/logout.go
index 9f5927176b..51c7cb884e 100644
--- a/cmd/argocd/commands/logout.go
+++ b/cmd/argocd/commands/logout.go
@@ -44,7 +44,7 @@ argocd logout cd.argoproj.io
localCfg, err := localconfig.ReadLocalConfig(clientOpts.ConfigPath)
errutil.CheckError(err)
if localCfg == nil {
- log.Fatalf("Nothing to logout from")
+ log.Fatal("Nothing to logout from")
}
promptUtil := utils.NewPrompt(clientOpts.PromptsEnabled)
diff --git a/cmd/argocd/commands/project.go b/cmd/argocd/commands/project.go
index a4c257eef4..9e837a3373 100644
--- a/cmd/argocd/commands/project.go
+++ b/cmd/argocd/commands/project.go
@@ -493,7 +493,7 @@ func NewProjectAddSourceCommand(clientOpts *argocdclient.ClientOptions) *cobra.C
for _, item := range proj.Spec.SourceRepos {
if item == "*" {
- fmt.Printf("Source repository '*' already allowed in project\n")
+ fmt.Print("Source repository '*' already allowed in project\n")
return
}
if git.SameURL(item, url) {
@@ -535,7 +535,7 @@ func NewProjectAddSourceNamespace(clientOpts *argocdclient.ClientOptions) *cobra
for _, item := range proj.Spec.SourceNamespaces {
if item == "*" || item == srcNamespace {
- fmt.Printf("Source namespace '*' already allowed in project\n")
+ fmt.Print("Source namespace '*' already allowed in project\n")
return
}
}
@@ -868,7 +868,7 @@ func printProjectNames(projects []v1alpha1.AppProject) {
// Print table of project info
func printProjectTable(projects []v1alpha1.AppProject) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- fmt.Fprintf(w, "NAME\tDESCRIPTION\tDESTINATIONS\tSOURCES\tCLUSTER-RESOURCE-WHITELIST\tNAMESPACE-RESOURCE-BLACKLIST\tSIGNATURE-KEYS\tORPHANED-RESOURCES\tDESTINATION-SERVICE-ACCOUNTS\n")
+ fmt.Fprint(w, "NAME\tDESCRIPTION\tDESTINATIONS\tSOURCES\tCLUSTER-RESOURCE-WHITELIST\tNAMESPACE-RESOURCE-BLACKLIST\tSIGNATURE-KEYS\tORPHANED-RESOURCES\tDESTINATION-SERVICE-ACCOUNTS\n")
for _, p := range projects {
printProjectLine(w, &p)
}
diff --git a/cmd/argocd/commands/project_role.go b/cmd/argocd/commands/project_role.go
index ca312047ee..90cf41df72 100644
--- a/cmd/argocd/commands/project_role.go
+++ b/cmd/argocd/commands/project_role.go
@@ -421,7 +421,7 @@ fa9d3517-c52d-434c-9bff-215b38508842 2023-10-08T11:08:18+01:00 Never
}
writer := tabwriter.NewWriter(os.Stdout, 0, 0, 4, ' ', 0)
- _, err = fmt.Fprintf(writer, "ID\tISSUED AT\tEXPIRES AT\n")
+ _, err = fmt.Fprint(writer, "ID\tISSUED AT\tEXPIRES AT\n")
errors.CheckError(err)
tokenRowFormat := "%s\t%v\t%v\n"
@@ -515,7 +515,7 @@ func printProjectRoleListName(roles []v1alpha1.ProjectRole) {
// Print table of project roles
func printProjectRoleListTable(roles []v1alpha1.ProjectRole) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- fmt.Fprintf(w, "ROLE-NAME\tDESCRIPTION\n")
+ fmt.Fprint(w, "ROLE-NAME\tDESCRIPTION\n")
for _, role := range roles {
fmt.Fprintf(w, "%s\t%s\n", role.Name, role.Description)
}
@@ -603,9 +603,9 @@ ID ISSUED-AT EXPIRES-AT
printRoleFmtStr := "%-15s%s\n"
fmt.Printf(printRoleFmtStr, "Role Name:", roleName)
fmt.Printf(printRoleFmtStr, "Description:", role.Description)
- fmt.Printf("Policies:\n")
+ fmt.Print("Policies:\n")
fmt.Printf("%s\n", proj.ProjectPoliciesString())
- fmt.Printf("Groups:\n")
+ fmt.Print("Groups:\n")
// if the group exists in the role
// range over each group and print it
if v1alpha1.RoleGroupExists(role) {
@@ -615,9 +615,9 @@ ID ISSUED-AT EXPIRES-AT
} else {
fmt.Println("")
}
- fmt.Printf("JWT Tokens:\n")
+ fmt.Print("JWT Tokens:\n")
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- fmt.Fprintf(w, "ID\tISSUED-AT\tEXPIRES-AT\n")
+ fmt.Fprint(w, "ID\tISSUED-AT\tEXPIRES-AT\n")
for _, token := range proj.Status.JWTTokensByRole[roleName].Items {
expiresAt := ""
if token.ExpiresAt > 0 {
diff --git a/cmd/argocd/commands/projectwindows.go b/cmd/argocd/commands/projectwindows.go
index 87d5dfe1a5..8f0549e2b6 100644
--- a/cmd/argocd/commands/projectwindows.go
+++ b/cmd/argocd/commands/projectwindows.go
@@ -248,7 +248,7 @@ argocd proj windows delete new-project 1`,
_, err = projIf.Update(ctx, &projectpkg.ProjectUpdateRequest{Project: proj})
errors.CheckError(err)
} else {
- fmt.Printf("The command to delete the sync window was cancelled\n")
+ fmt.Print("The command to delete the sync window was cancelled\n")
}
},
}
diff --git a/cmd/argocd/commands/relogin.go b/cmd/argocd/commands/relogin.go
index 9bbd9136d9..74bac1df11 100644
--- a/cmd/argocd/commands/relogin.go
+++ b/cmd/argocd/commands/relogin.go
@@ -40,7 +40,7 @@ func NewReloginCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command {
localCfg, err := localconfig.ReadLocalConfig(clientOpts.ConfigPath)
errors.CheckError(err)
if localCfg == nil {
- log.Fatalf("No context found. Login using `argocd login`")
+ log.Fatal("No context found. Login using `argocd login`")
}
configCtx, err := localCfg.ResolveContext(localCfg.CurrentContext)
errors.CheckError(err)
diff --git a/cmd/argocd/commands/repo.go b/cmd/argocd/commands/repo.go
index 1067ecbe73..b6aa1421eb 100644
--- a/cmd/argocd/commands/repo.go
+++ b/cmd/argocd/commands/repo.go
@@ -329,7 +329,7 @@ func NewRepoRemoveCommand(clientOpts *argocdclient.ClientOptions) *cobra.Command
// Print table of repo info
func printRepoTable(repos appsv1.Repositories) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- _, _ = fmt.Fprintf(w, "TYPE\tNAME\tREPO\tINSECURE\tOCI\tLFS\tCREDS\tSTATUS\tMESSAGE\tPROJECT\n")
+ _, _ = fmt.Fprint(w, "TYPE\tNAME\tREPO\tINSECURE\tOCI\tLFS\tCREDS\tSTATUS\tMESSAGE\tPROJECT\n")
for _, r := range repos {
var hasCreds string
if r.InheritedCreds {
diff --git a/cmd/argocd/commands/repocreds.go b/cmd/argocd/commands/repocreds.go
index 4de0a20e85..1e06fa3f74 100644
--- a/cmd/argocd/commands/repocreds.go
+++ b/cmd/argocd/commands/repocreds.go
@@ -253,7 +253,7 @@ func NewRepoCredsRemoveCommand(clientOpts *argocdclient.ClientOptions) *cobra.Co
// Print the repository credentials as table
func printRepoCredsTable(repos []appsv1.RepoCreds) {
w := tabwriter.NewWriter(os.Stdout, 0, 0, 2, ' ', 0)
- fmt.Fprintf(w, "URL PATTERN\tUSERNAME\tSSH_CREDS\tTLS_CREDS\n")
+ fmt.Fprint(w, "URL PATTERN\tUSERNAME\tSSH_CREDS\tTLS_CREDS\n")
for _, r := range repos {
if r.Username == "" {
r.Username = "-"
diff --git a/cmd/util/app.go b/cmd/util/app.go
index 91e69ecd09..96b5bc8c39 100644
--- a/cmd/util/app.go
+++ b/cmd/util/app.go
@@ -541,7 +541,7 @@ func SetParameterOverrides(app *argoappv1.Application, parameters []string, inde
source.Helm.AddParameter(*newParam)
}
default:
- log.Fatalf("Parameters can only be set against Helm applications")
+ log.Fatal("Parameters can only be set against Helm applications")
}
}
diff --git a/cmd/util/applicationset_test.go b/cmd/util/applicationset_test.go
index 45255fd6d3..4641efaaaf 100644
--- a/cmd/util/applicationset_test.go
+++ b/cmd/util/applicationset_test.go
@@ -35,7 +35,7 @@ func TestReadAppSet(t *testing.T) {
var appSets []*argoprojiov1alpha1.ApplicationSet
err := readAppset([]byte(appSet), &appSets)
if err != nil {
- t.Logf("Failed reading appset file")
+ t.Log("Failed reading appset file")
}
assert.Len(t, appSets, 1)
}
diff --git a/hack/gen-resources/generators/application_generator.go b/hack/gen-resources/generators/application_generator.go
index 944eabaa29..d8a9b1fa99 100644
--- a/hack/gen-resources/generators/application_generator.go
+++ b/hack/gen-resources/generators/application_generator.go
@@ -84,7 +84,7 @@ func (generator *ApplicationGenerator) Generate(opts *util.GenerateOpts) error {
return err
}
log.Printf("Pick destination %q", destination)
- log.Printf("Create application")
+ log.Print("Create application")
_, err = applications.Create(context.TODO(), &v1alpha1.Application{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "application-",
@@ -105,7 +105,7 @@ func (generator *ApplicationGenerator) Generate(opts *util.GenerateOpts) error {
}
func (generator *ApplicationGenerator) Clean(opts *util.GenerateOpts) error {
- log.Printf("Clean applications")
+ log.Print("Clean applications")
applications := generator.argoClientSet.ArgoprojV1alpha1().Applications(opts.Namespace)
return applications.DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{
LabelSelector: "app.kubernetes.io/generated-by=argocd-generator",
diff --git a/hack/gen-resources/generators/cluster_generator.go b/hack/gen-resources/generators/cluster_generator.go
index 3c01e4326e..a6afd7564a 100644
--- a/hack/gen-resources/generators/cluster_generator.go
+++ b/hack/gen-resources/generators/cluster_generator.go
@@ -251,7 +251,7 @@ func (cg *ClusterGenerator) Generate(opts *util.GenerateOpts) error {
}
func (cg *ClusterGenerator) Clean(opts *util.GenerateOpts) error {
- log.Printf("Clean clusters")
+ log.Print("Clean clusters")
namespaces, err := cg.clientSet.CoreV1().Namespaces().List(context.TODO(), metav1.ListOptions{})
if err != nil {
return err
diff --git a/hack/gen-resources/generators/project_generator.go b/hack/gen-resources/generators/project_generator.go
index c33586510f..7bc275fdfa 100644
--- a/hack/gen-resources/generators/project_generator.go
+++ b/hack/gen-resources/generators/project_generator.go
@@ -43,7 +43,7 @@ func (pg *ProjectGenerator) Generate(opts *util.GenerateOpts) error {
}
func (pg *ProjectGenerator) Clean(opts *util.GenerateOpts) error {
- log.Printf("Clean projects")
+ log.Print("Clean projects")
projects := pg.clientSet.ArgoprojV1alpha1().AppProjects(opts.Namespace)
return projects.DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{
LabelSelector: "app.kubernetes.io/generated-by=argocd-generator",
diff --git a/hack/gen-resources/generators/repo_generator.go b/hack/gen-resources/generators/repo_generator.go
index c409e96d2d..598283db62 100644
--- a/hack/gen-resources/generators/repo_generator.go
+++ b/hack/gen-resources/generators/repo_generator.go
@@ -117,7 +117,7 @@ func (rg *RepoGenerator) Generate(opts *util.GenerateOpts) error {
}
func (rg *RepoGenerator) Clean(opts *util.GenerateOpts) error {
- log.Printf("Clean repos")
+ log.Print("Clean repos")
secrets := rg.clientSet.CoreV1().Secrets(opts.Namespace)
return secrets.DeleteCollection(context.TODO(), metav1.DeleteOptions{}, metav1.ListOptions{
LabelSelector: "app.kubernetes.io/generated-by=argocd-generator",
diff --git a/server/logout/logout_test.go b/server/logout/logout_test.go
index 40bcd8c611..c7b17565f6 100644
--- a/server/logout/logout_test.go
+++ b/server/logout/logout_test.go
@@ -463,7 +463,7 @@ func TestHandlerConstructLogoutURL(t *testing.T) {
}
} else {
if tt.wantErr {
- t.Errorf("expected error but did not get one")
+ t.Error("expected error but did not get one")
} else {
require.Equal(t, tt.expectedLogoutURL, tt.responseRecorder.Result().Header["Location"][0])
}
diff --git a/test/e2e/managed_by_url_test.go b/test/e2e/managed_by_url_test.go
index 6ea8c319ea..7563edda79 100644
--- a/test/e2e/managed_by_url_test.go
+++ b/test/e2e/managed_by_url_test.go
@@ -183,7 +183,7 @@ func TestManagedByURLFallbackToCurrentInstance(t *testing.T) {
}
}
if !found {
- t.Logf("Returned links:")
+ t.Log("Returned links:")
for _, link := range links.Items {
if link.Url != nil {
t.Logf("- %s", *link.Url)
diff --git a/util/cli/cli_test.go b/util/cli/cli_test.go
index bc86097793..6032583f45 100644
--- a/util/cli/cli_test.go
+++ b/util/cli/cli_test.go
@@ -80,7 +80,7 @@ func TestSetLogFormat(t *testing.T) {
if errors.As(err, &e) {
return
}
- t.Fatalf("expected fatal exit for invalid log format")
+ t.Fatal("expected fatal exit for invalid log format")
} else {
SetLogFormat(tt.logFormat)
assert.Equal(t, tt.expected, os.Getenv(common.EnvLogFormat))
diff --git a/util/helm/client_test.go b/util/helm/client_test.go
index d84a9831e1..fdc2f3c47c 100644
--- a/util/helm/client_test.go
+++ b/util/helm/client_test.go
@@ -719,7 +719,7 @@ entries: {}
// Should succeed because our implementation sets User-Agent
require.NoError(t, err, "Request should succeed with User-Agent set")
- t.Logf("Success! Server accepted request with User-Agent")
+ t.Log("Success! Server accepted request with User-Agent")
})
}
diff --git a/util/tls/tls.go b/util/tls/tls.go
index 36b9e3909b..26806c50a5 100644
--- a/util/tls/tls.go
+++ b/util/tls/tls.go
@@ -139,7 +139,7 @@ func getTLSConfigCustomizer(minVersionStr, maxVersionStr, tlsCiphersStr string)
}
if tlsCiphersStr == "list" {
- fmt.Printf("Supported TLS ciphers:\n")
+ fmt.Print("Supported TLS ciphers:\n")
for _, s := range tls.CipherSuites() {
fmt.Printf("* %s (TLS versions: %s)\n", tls.CipherSuiteName(s.ID), strings.Join(tlsVersionsToStr(s.SupportedVersions), ", "))
}