Uploaded image for project: 'OpenShift GitOps'
  1. OpenShift GitOps
  2. GITOPS-5439

argocd-operator golangci-lint obsolete config and reported errors

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Normal Normal
    • None
    • None
    • None
    • 5
    • GitOps Tangerine - Sprint 3262

      Description of problem:

      When running golangci-lint run command in argocd-operator project, seeing the following error message:

      WARN [config_reader] The configuration option `run.skip-files` is deprecated, please use `issues.exclude-files`.
      WARN [config_reader] The configuration option `run.skip-dirs` is deprecated, please use `issues.exclude-dirs`.
      WARN [lintersdb] The name "vet" is deprecated. The linter has been renamed to: govet.
      WARN The linter 'deadcode' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
      WARN The linter 'structcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
      WARN The linter 'varcheck' is deprecated (since v1.49.0) due to: The owner seems to have abandoned the linter. Replaced by unused.
      ERRO [linters_context] deadcode: This linter is fully inactivated: it will not produce any reports.
      ERRO [linters_context] structcheck: This linter is fully inactivated: it will not produce any reports.
      ERRO [linters_context] varcheck: This linter is fully inactivated: it will not produce any reports.
      api/v1alpha1/argocd_conversion.go:64:2: SA1019: dst.Spec.Grafana is deprecated: Grafana defines the Grafana server options for ArgoCD. (staticcheck)
      	dst.Spec.Grafana = *ConvertAlphaToBetaGrafana(&src.Spec.Grafana)
      	^
      api/v1alpha1/argocd_conversion.go:133:49: SA1019: src.Spec.Grafana is deprecated: Grafana defines the Grafana server options for ArgoCD. (staticcheck)
      	dst.Spec.Grafana = *ConvertBetaToAlphaGrafana(&src.Spec.Grafana)
      	                                               ^
      controllers/argocd/networkpolicies.go:8: File is not `goimports`-ed with -local github.com/argoproj-labs/argocd-operator (goimports)
      	argoproj "github.com/argoproj-labs/argocd-operator/api/v1beta1"
      	"github.com/argoproj-labs/argocd-operator/controllers/argoutil"
      controllers/argocd/role.go:190:71: `(*ReconcileArgoCD).reconcileRoleForApplicationSourceNamespaces` - `name` always receives `"argocd-server"` (unparam)
      func (r *ReconcileArgoCD) reconcileRoleForApplicationSourceNamespaces(name string, policyRules []v1.PolicyRule, cr *argoproj.ArgoCD) error {
                                                                            ^
      controllers/argocd/deployment.go:329:5: S1009: should omit nil check; len() for []string is defined as zero (gosimple)
      	if cr.Spec.SourceNamespaces != nil && len(cr.Spec.SourceNamespaces) > 0 {
      	   ^
      controllers/argocd/util.go:167:5: S1009: should omit nil check; len() for []string is defined as zero (gosimple)
      	if cr.Spec.SourceNamespaces != nil && len(cr.Spec.SourceNamespaces) > 0 {
      	   ^
      controllers/argocd/prometheus.go:282:194: printf: non-constant format string in call to fmt.Sprintf (govet)
      						StrVal: fmt.Sprintf("kube_statefulset_status_replicas{statefulset=\"%s\", namespace=\"%s\"} != kube_statefulset_status_replicas_ready{statefulset=\"%s\", namespace=\"%s\"} ", fmt.Sprintf(cr.Name+"-application-controller"), cr.Namespace, fmt.Sprintf(cr.Name+"-application-controller"), cr.Namespace),
      						                                                                                                                                                                                           ^
      controllers/argocd/prometheus.go:296:190: printf: non-constant format string in call to fmt.Sprintf (govet)
      						StrVal: fmt.Sprintf("kube_deployment_status_replicas{deployment=\"%s\", namespace=\"%s\"} != kube_deployment_status_replicas_ready{deployment=\"%s\", namespace=\"%s\"} ", fmt.Sprintf(cr.Name+"-server"), cr.Namespace, fmt.Sprintf(cr.Name+"-server"), cr.Namespace),
      						                                                                                                                                                                                       ^
      controllers/argocd/prometheus.go:310:190: printf: non-constant format string in call to fmt.Sprintf (govet)
      						StrVal: fmt.Sprintf("kube_deployment_status_replicas{deployment=\"%s\", namespace=\"%s\"} != kube_deployment_status_replicas_ready{deployment=\"%s\", namespace=\"%s\"} ", fmt.Sprintf(cr.Name+"-repo-server"), cr.Namespace, fmt.Sprintf(cr.Name+"-repo-server"), cr.Namespace),
      						                                                                                                                                                                                       ^
      controllers/argocd/configmap.go:479:6: SA1019: cr.Spec.Grafana is deprecated: Grafana defines the Grafana server options for ArgoCD. (staticcheck)
      	if !cr.Spec.Grafana.Enabled {
      	    ^
      controllers/argocd/configmap.go:490:6: SA1019: cr.Spec.Grafana is deprecated: Grafana defines the Grafana server options for ArgoCD. (staticcheck)
      	if !cr.Spec.Grafana.Enabled {
      	    ^
      controllers/argocd/deployment.go:454:6: SA1019: cr.Spec.Grafana is deprecated: Grafana defines the Grafana server options for ArgoCD. (staticcheck)
      	if !cr.Spec.Grafana.Enabled {
      	    ^
      controllers/notificationsconfiguration/configmap.go:8: File is not `goimports`-ed with -local github.com/argoproj-labs/argocd-operator (goimports)
      	"github.com/argoproj-labs/argocd-operator/api/v1alpha1"
      	"github.com/argoproj-labs/argocd-operator/controllers/argoutil"
      

       
      Workaround:

      use older version of golangci-lint, but will miss new checks in new versions.

      Prerequisites (if any, like setup, operators/versions):

      Steps to Reproduce

       # <steps>

       

      Actual results:

      Expected results:

      Reproducibility (Always/Intermittent/Only Once):

      Acceptance criteria: 

      • all config warnings are fixed and .golangci.yaml should be updated to the latest schema
      • all errors reported are fixed 

      Definition of Done:

      Build Details:

      Additional info (Such as Logs, Screenshots, etc):

       

       *

            cfang@redhat.com Cheng Fang
            cfang@redhat.com Cheng Fang
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: