Skip to content

Commit

Permalink
chore: fix golangci-lint errors (#905)
Browse files Browse the repository at this point in the history
  • Loading branch information
mowies committed Feb 27, 2023
1 parent 09a4f94 commit a133fdd
Show file tree
Hide file tree
Showing 56 changed files with 229 additions and 223 deletions.
3 changes: 0 additions & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ linters:

issues:
exclude-rules:
- linters:
- gci
text: '//+kubebuilder'
- linters:
- containedctx
- gocyclo
Expand Down
8 changes: 0 additions & 8 deletions klt-cert-manager/controllers/keptnwebhookcontroller/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ package keptnwebhookcontroller

import (
"time"

"k8s.io/apimachinery/pkg/runtime/schema"
)

const (
Expand All @@ -18,9 +16,3 @@ const (
certificatesSecretEmptyErr = "certificates secret is empty"
couldNotUpdateCRDErr = "could not update crd config"
)

var keptnCRD = schema.GroupVersionResource{Group: "lifecycle.keptn.sh"}
var crdversion = schema.GroupVersion{
Group: "apiextensions.k8s.io",
Version: "v1",
}
7 changes: 4 additions & 3 deletions klt-cert-manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/healthz"
"sigs.k8s.io/controller-runtime/pkg/log/zap"
//+kubebuilder:scaffold:imports
// nolint:gci
// +kubebuilder:scaffold:imports
)

var (
Expand All @@ -30,7 +31,7 @@ func init() {
utilruntime.Must(clientgoscheme.AddToScheme(scheme))
utilruntime.Must(corev1.AddToScheme(scheme))
utilruntime.Must(apiv1.AddToScheme(scheme))
//+kubebuilder:scaffold:scheme
// +kubebuilder:scaffold:scheme
}

type envConfig struct {
Expand Down Expand Up @@ -93,7 +94,7 @@ func main() {
os.Exit(1)
}

//+kubebuilder:scaffold:builder
// +kubebuilder:scaffold:builder

if err := mgr.AddHealthzCheck("healthz", healthz.Ping); err != nil {
setupLog.Error(err, "unable to set up health check")
Expand Down
6 changes: 3 additions & 3 deletions operator/apis/lifecycle/v1alpha1/keptnapp_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@ type KeptnWorkloadRef struct {
Version string `json:"version"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// KeptnApp is the Schema for the keptnapps API
type KeptnApp struct {
Expand All @@ -60,7 +60,7 @@ type KeptnApp struct {
Status KeptnAppStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// KeptnAppList contains a list of KeptnApp
type KeptnAppList struct {
Expand Down
10 changes: 5 additions & 5 deletions operator/apis/lifecycle/v1alpha1/keptnappversion_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ type WorkloadStatus struct {
Status common.KeptnState `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:resource:path=keptnappversions,shortName=kav
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.appName`
// +kubebuilder:object:root=true
// +kubebuilder:resource:path=keptnappversions,shortName=kav
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.appName`
// +kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version`
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.currentPhase`
// +kubebuilder:printcolumn:name="PreDeploymentStatus",priority=1,type=string,JSONPath=`.status.preDeploymentStatus`
Expand All @@ -93,7 +93,7 @@ type KeptnAppVersion struct {
Status KeptnAppVersionStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// KeptnAppVersionList contains a list of KeptnAppVersion
type KeptnAppVersionList struct {
Expand Down
22 changes: 11 additions & 11 deletions operator/apis/lifecycle/v1alpha1/keptnevaluation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@ type EvaluationStatusItem struct {
Message string `json:"message,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:path=keptnevaluations,shortName=ke
//+kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.appName`
//+kubebuilder:printcolumn:name="AppVersion",type=string,JSONPath=`.spec.appVersion`
//+kubebuilder:printcolumn:name="WorkloadName",type=string,JSONPath=`.spec.workload`
//+kubebuilder:printcolumn:name="WorkloadVersion",type=string,JSONPath=`.spec.workloadVersion`
//+kubebuilder:printcolumn:name="RetryCount",type=string,JSONPath=`.status.retryCount`
//+kubebuilder:printcolumn:name="EvaluationStatus",type=string,JSONPath=`.status.evaluationStatus`
//+kubebuilder:printcolumn:name="OverallStatus",type=string,JSONPath=`.status.overallStatus`
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=keptnevaluations,shortName=ke
// +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.appName`
// +kubebuilder:printcolumn:name="AppVersion",type=string,JSONPath=`.spec.appVersion`
// +kubebuilder:printcolumn:name="WorkloadName",type=string,JSONPath=`.spec.workload`
// +kubebuilder:printcolumn:name="WorkloadVersion",type=string,JSONPath=`.spec.workloadVersion`
// +kubebuilder:printcolumn:name="RetryCount",type=string,JSONPath=`.status.retryCount`
// +kubebuilder:printcolumn:name="EvaluationStatus",type=string,JSONPath=`.status.evaluationStatus`
// +kubebuilder:printcolumn:name="OverallStatus",type=string,JSONPath=`.status.overallStatus`

// KeptnEvaluation is the Schema for the keptnevaluations API
type KeptnEvaluation struct {
Expand All @@ -86,7 +86,7 @@ type KeptnEvaluation struct {
Status KeptnEvaluationStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// KeptnEvaluationList contains a list of KeptnEvaluation
type KeptnEvaluationList struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@ type KeptnEvaluationDefinitionStatus struct {
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:path=keptnevaluationdefinitions,shortName=ked
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=keptnevaluationdefinitions,shortName=ked

// KeptnEvaluationDefinition is the Schema for the keptnevaluationdefinitions API
type KeptnEvaluationDefinition struct {
Expand All @@ -54,7 +54,7 @@ type KeptnEvaluationDefinition struct {
Status KeptnEvaluationDefinitionStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// KeptnEvaluationDefinitionList contains a list of KeptnEvaluationDefinition
type KeptnEvaluationDefinitionList struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,9 @@ type KeptnEvaluationProviderStatus struct {
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:path=keptnevaluationproviders,shortName=kep
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=keptnevaluationproviders,shortName=kep

// KeptnEvaluationProvider is the Schema for the keptnevaluationproviders API
type KeptnEvaluationProvider struct {
Expand All @@ -48,7 +48,7 @@ type KeptnEvaluationProvider struct {
Status KeptnEvaluationProviderStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// KeptnEvaluationProviderList contains a list of KeptnEvaluationProvider
type KeptnEvaluationProviderList struct {
Expand Down
6 changes: 3 additions & 3 deletions operator/apis/lifecycle/v1alpha1/keptntask_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,8 @@ type KeptnTaskStatus struct {
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.app`
// +kubebuilder:printcolumn:name="AppVersion",type=string,JSONPath=`.spec.appVersion`
// +kubebuilder:printcolumn:name="WorkloadName",type=string,JSONPath=`.spec.workload`
Expand All @@ -90,7 +90,7 @@ type KeptnTask struct {
Status KeptnTaskStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// KeptnTaskList contains a list of KeptnTask
type KeptnTaskList struct {
Expand Down
6 changes: 3 additions & 3 deletions operator/apis/lifecycle/v1alpha1/keptntaskdefinition_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ type FunctionStatus struct {
ConfigMap string `json:"configMap,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status

// KeptnTaskDefinition is the Schema for the keptntaskdefinitions API
type KeptnTaskDefinition struct {
Expand All @@ -81,7 +81,7 @@ type KeptnTaskDefinition struct {
Status KeptnTaskDefinitionStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// KeptnTaskDefinitionList contains a list of KeptnTaskDefinition
type KeptnTaskDefinitionList struct {
Expand Down
6 changes: 3 additions & 3 deletions operator/apis/lifecycle/v1alpha1/keptnworkload_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ type KeptnWorkloadStatus struct {
CurrentVersion string `json:"currentVersion,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.app`
// +kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version`

Expand All @@ -59,7 +59,7 @@ type KeptnWorkload struct {
Status KeptnWorkloadStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// KeptnWorkloadList contains a list of KeptnWorkload
type KeptnWorkloadList struct {
Expand Down
12 changes: 6 additions & 6 deletions operator/apis/lifecycle/v1alpha1/keptnworkloadinstance_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,9 @@ type EvaluationStatus struct {
EndTime metav1.Time `json:"endTime,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:resource:path=keptnworkloadinstances,shortName=kwi
//+kubebuilder:subresource:status
// +kubebuilder:object:root=true
// +kubebuilder:resource:path=keptnworkloadinstances,shortName=kwi
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.app`
// +kubebuilder:printcolumn:name="WorkloadName",type=string,JSONPath=`.spec.workloadName`
// +kubebuilder:printcolumn:name="WorkloadVersion",type=string,JSONPath=`.spec.version`
Expand All @@ -103,7 +103,7 @@ type KeptnWorkloadInstance struct {
Status KeptnWorkloadInstanceStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// KeptnWorkloadInstanceList contains a list of KeptnWorkloadInstance
type KeptnWorkloadInstanceList struct {
Expand Down Expand Up @@ -402,12 +402,12 @@ func (w *KeptnWorkloadInstance) CancelRemainingPhases(phase common.KeptnPhaseTyp
if phase == common.PhaseWorkloadPostEvaluation {
return
}
//cancel everything if app pre-eval tasks have failed
// cancel everything if app pre-eval tasks have failed
if phase == common.PhaseAppPreEvaluation {
w.Status.PreDeploymentStatus = common.StateCancelled
w.Status.PreDeploymentEvaluationStatus = common.StateCancelled
}
//cancel deployment and post-deployment tasks if workload pre-eval tasks have failed
// cancel deployment and post-deployment tasks if workload pre-eval tasks have failed
w.Status.DeploymentStatus = common.StateCancelled
w.Status.PostDeploymentStatus = common.StateCancelled
w.Status.PostDeploymentEvaluationStatus = common.StateCancelled
Expand Down
8 changes: 4 additions & 4 deletions operator/apis/lifecycle/v1alpha2/keptnapp_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,9 @@ type KeptnWorkloadRef struct {
Version string `json:"version"`
}

//+kubebuilder:object:root=true
//+kubebuilder:storageversion
//+kubebuilder:subresource:status
// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:subresource:status

// KeptnApp is the Schema for the keptnapps API
type KeptnApp struct {
Expand All @@ -65,7 +65,7 @@ type KeptnApp struct {
Status KeptnAppStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// KeptnAppList contains a list of KeptnApp
type KeptnAppList struct {
Expand Down
12 changes: 6 additions & 6 deletions operator/apis/lifecycle/v1alpha2/keptnappversion_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,11 @@ type WorkloadStatus struct {
Status common.KeptnState `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:storageversion
//+kubebuilder:resource:path=keptnappversions,shortName=kav
//+kubebuilder:subresource:status
//+kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.appName`
// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:resource:path=keptnappversions,shortName=kav
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.appName`
// +kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.spec.version`
// +kubebuilder:printcolumn:name="Phase",type=string,JSONPath=`.status.currentPhase`
// +kubebuilder:printcolumn:name="PreDeploymentStatus",priority=1,type=string,JSONPath=`.status.preDeploymentStatus`
Expand All @@ -94,7 +94,7 @@ type KeptnAppVersion struct {
Status KeptnAppVersionStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// KeptnAppVersionList contains a list of KeptnAppVersion
type KeptnAppVersionList struct {
Expand Down
24 changes: 12 additions & 12 deletions operator/apis/lifecycle/v1alpha2/keptnevaluation_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,17 +66,17 @@ type EvaluationStatusItem struct {
Message string `json:"message,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:storageversion
//+kubebuilder:subresource:status
//+kubebuilder:resource:path=keptnevaluations,shortName=ke
//+kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.appName`
//+kubebuilder:printcolumn:name="AppVersion",type=string,JSONPath=`.spec.appVersion`
//+kubebuilder:printcolumn:name="WorkloadName",type=string,JSONPath=`.spec.workload`
//+kubebuilder:printcolumn:name="WorkloadVersion",type=string,JSONPath=`.spec.workloadVersion`
//+kubebuilder:printcolumn:name="RetryCount",type=string,JSONPath=`.status.retryCount`
//+kubebuilder:printcolumn:name="EvaluationStatus",type=string,JSONPath=`.status.evaluationStatus`
//+kubebuilder:printcolumn:name="OverallStatus",type=string,JSONPath=`.status.overallStatus`
// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=keptnevaluations,shortName=ke
// +kubebuilder:printcolumn:name="AppName",type=string,JSONPath=`.spec.appName`
// +kubebuilder:printcolumn:name="AppVersion",type=string,JSONPath=`.spec.appVersion`
// +kubebuilder:printcolumn:name="WorkloadName",type=string,JSONPath=`.spec.workload`
// +kubebuilder:printcolumn:name="WorkloadVersion",type=string,JSONPath=`.spec.workloadVersion`
// +kubebuilder:printcolumn:name="RetryCount",type=string,JSONPath=`.status.retryCount`
// +kubebuilder:printcolumn:name="EvaluationStatus",type=string,JSONPath=`.status.evaluationStatus`
// +kubebuilder:printcolumn:name="OverallStatus",type=string,JSONPath=`.status.overallStatus`

// KeptnEvaluation is the Schema for the keptnevaluations API
type KeptnEvaluation struct {
Expand All @@ -87,7 +87,7 @@ type KeptnEvaluation struct {
Status KeptnEvaluationStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// KeptnEvaluationList contains a list of KeptnEvaluation
type KeptnEvaluationList struct {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ type KeptnEvaluationDefinitionStatus struct {
// Important: Run "make" to regenerate code after modifying this file
}

//+kubebuilder:object:root=true
//+kubebuilder:storageversion
//+kubebuilder:subresource:status
//+kubebuilder:resource:path=keptnevaluationdefinitions,shortName=ked
// +kubebuilder:object:root=true
// +kubebuilder:storageversion
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=keptnevaluationdefinitions,shortName=ked

// KeptnEvaluationDefinition is the Schema for the keptnevaluationdefinitions API
type KeptnEvaluationDefinition struct {
Expand All @@ -55,7 +55,7 @@ type KeptnEvaluationDefinition struct {
Status KeptnEvaluationDefinitionStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true

// KeptnEvaluationDefinitionList contains a list of KeptnEvaluationDefinition
type KeptnEvaluationDefinitionList struct {
Expand Down

0 comments on commit a133fdd

Please sign in to comment.