Skip to content

Commit

Permalink
Fix formatting and enable more linters for that
Browse files Browse the repository at this point in the history
  • Loading branch information
koct9i committed Jun 27, 2024
1 parent 0b71a88 commit 9784f6e
Show file tree
Hide file tree
Showing 46 changed files with 114 additions and 115 deletions.
6 changes: 3 additions & 3 deletions .golangci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ linters:
# - gochecknoinits # checks that no init functions are present in Go code
# - goconst # finds repeated strings that could be replaced by a constant
- gocritic # provides diagnostics that check for bugs, performance and style issues
# - godot # checks if comments end in a period
# - goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt
- godot # checks if comments end in a period
- goimports # in addition to fixing imports, goimports also formats your code in the same style as gofmt
# - gomnd # detects magic numbers
- gomoddirectives # manages the use of 'replace', 'retract', and 'excludes' directives in go.mod
- gomodguard # allow and block lists linter for direct Go module dependencies. This is different from depguard where there are different block types for example version constraints and module recommendations
Expand Down Expand Up @@ -110,7 +110,7 @@ linters:
# - unparam # reports unused function parameters
- usestdlibvars # detects the possibility to use variables/constants from the Go standard library
- wastedassign # finds wasted assignment statements
# - whitespace # detects leading and trailing whitespace
- whitespace # detects leading and trailing whitespace
# - wrapcheck # checks that errors returned from external packages are wrapped
# - wsl # add or remove empty lines

Expand Down
8 changes: 4 additions & 4 deletions api/v1/chyt_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ const (
ChytReleaseStatusFinished ChytReleaseStatus = "Finished"
)

// ChytSpec defines the desired state of Chyt
// ChytSpec defines the desired state of Chyt.
type ChytSpec struct {
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`

Expand All @@ -44,7 +44,7 @@ type ChytSpec struct {
MakeDefault bool `json:"makeDefault"`
}

// ChytStatus defines the observed state of Chyt
// ChytStatus defines the observed state of Chyt.
type ChytStatus struct {
Conditions []metav1.Condition `json:"conditions,omitempty"`
ReleaseStatus ChytReleaseStatus `json:"releaseStatus,omitempty"`
Expand All @@ -54,7 +54,7 @@ type ChytStatus struct {
// +kubebuilder:printcolumn:name="ReleaseStatus",type="string",JSONPath=".status.releaseStatus",description="Status of release"
//+kubebuilder:subresource:status

// Chyt is the Schema for the chyts API
// Chyt is the Schema for the chyts API.
type Chyt struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -65,7 +65,7 @@ type Chyt struct {

//+kubebuilder:object:root=true

// ChytList contains a list of Chyt
// ChytList contains a list of Chyt.
type ChytList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Expand Down
8 changes: 4 additions & 4 deletions api/v1/chyt_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (r *Chyt) SetupWebhookWithManager(mgr ctrl.Manager) error {

var _ webhook.Defaulter = &Chyt{}

// Default implements webhook.Defaulter so a webhook will be registered for the type
// Default implements webhook.Defaulter so a webhook will be registered for the type.
func (r *Chyt) Default() {
chytlog.Info("default", "name", r.Name)

Expand All @@ -51,23 +51,23 @@ func (r *Chyt) Default() {

var _ webhook.Validator = &Chyt{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
func (r *Chyt) ValidateCreate() (admission.Warnings, error) {
chytlog.Info("validate create", "name", r.Name)

// TODO(user): fill in your validation logic upon object creation.
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
func (r *Chyt) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
chytlog.Info("validate update", "name", r.Name)

// TODO(user): fill in your validation logic upon object update.
return nil, nil
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.
func (r *Chyt) ValidateDelete() (admission.Warnings, error) {
chytlog.Info("validate delete", "name", r.Name)

Expand Down
4 changes: 2 additions & 2 deletions api/v1/groupversion_info.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ import (
)

var (
// GroupVersion is group version used to register these objects
// GroupVersion is group version used to register these objects.
GroupVersion = schema.GroupVersion{Group: "cluster.ytsaurus.tech", Version: "v1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

// AddToScheme adds the types in this group-version to the given scheme.
Expand Down
8 changes: 4 additions & 4 deletions api/v1/remoteexecnodes_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import (
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// RemoteExecNodesSpec defines the desired state of RemoteExecNodes
// RemoteExecNodesSpec defines the desired state of RemoteExecNodes.
type RemoteExecNodesSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
Expand All @@ -41,7 +41,7 @@ const (
RemoteExecNodeReleaseStatusRunning RemoteExecNodeReleaseStatus = "Running"
)

// RemoteExecNodesStatus defines the observed state of RemoteExecNodes
// RemoteExecNodesStatus defines the observed state of RemoteExecNodes.
type RemoteExecNodesStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Expand All @@ -52,7 +52,7 @@ type RemoteExecNodesStatus struct {
//+kubebuilder:printcolumn:name="ReleaseStatus",type="string",JSONPath=".status.releaseStatus",description="Release status"
//+kubebuilder:subresource:status

// RemoteExecNodes is the Schema for the remoteexecnodes API
// RemoteExecNodes is the Schema for the remoteexecnodes API.
type RemoteExecNodes struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -63,7 +63,7 @@ type RemoteExecNodes struct {

//+kubebuilder:object:root=true

// RemoteExecNodesList contains a list of RemoteExecNodes
// RemoteExecNodesList contains a list of RemoteExecNodes.
type RemoteExecNodesList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Expand Down
8 changes: 4 additions & 4 deletions api/v1/remoteytsaurus_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import (
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// RemoteYtsaurusSpec defines the desired state of RemoteYtsaurus
// RemoteYtsaurusSpec defines the desired state of RemoteYtsaurus.
type RemoteYtsaurusSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file
Expand All @@ -32,7 +32,7 @@ type RemoteYtsaurusSpec struct {
MasterCachesSpec `json:",inline"`
}

// RemoteYtsaurusStatus defines the observed state of RemoteYtsaurus
// RemoteYtsaurusStatus defines the observed state of RemoteYtsaurus.
type RemoteYtsaurusStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Expand All @@ -42,7 +42,7 @@ type RemoteYtsaurusStatus struct {
//+kubebuilder:resource:path=remoteytsaurus
//+kubebuilder:subresource:status

// RemoteYtsaurus is the Schema for the remoteytsauruses API
// RemoteYtsaurus is the Schema for the remoteytsauruses API.
type RemoteYtsaurus struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -53,7 +53,7 @@ type RemoteYtsaurus struct {

//+kubebuilder:object:root=true

// RemoteYtsaurusList contains a list of RemoteYtsaurus
// RemoteYtsaurusList contains a list of RemoteYtsaurus.
type RemoteYtsaurusList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Expand Down
8 changes: 4 additions & 4 deletions api/v1/spyt_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@ const (
SpytReleaseStatusFinished SpytReleaseStatus = "Finished"
)

// SpytSpec defines the desired state of Spyt
// SpytSpec defines the desired state of Spyt.
type SpytSpec struct {
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`

Ytsaurus *corev1.LocalObjectReference `json:"ytsaurus,omitempty"`
Image string `json:"image,omitempty"`
}

// SpytStatus defines the observed state of Spyt
// SpytStatus defines the observed state of Spyt.
type SpytStatus struct {
Conditions []metav1.Condition `json:"conditions,omitempty"`
ReleaseStatus SpytReleaseStatus `json:"releaseStatus,omitempty"`
Expand All @@ -55,7 +55,7 @@ type SpytStatus struct {
// +kubebuilder:printcolumn:name="ReleaseStatus",type="string",JSONPath=".status.releaseStatus",description="Status of release"
//+kubebuilder:subresource:status

// Spyt is the Schema for the spyts API
// Spyt is the Schema for the spyts API.
type Spyt struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -65,7 +65,7 @@ type Spyt struct {

//+kubebuilder:object:root=true

// SpytList contains a list of Spyt
// SpytList contains a list of Spyt.
type SpytList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Expand Down
8 changes: 4 additions & 4 deletions api/v1/spyt_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (r *Spyt) SetupWebhookWithManager(mgr ctrl.Manager) error {

var _ webhook.Defaulter = &Spyt{}

// Default implements webhook.Defaulter so a webhook will be registered for the type
// Default implements webhook.Defaulter so a webhook will be registered for the type.
func (r *Spyt) Default() {
spytlog.Info("default", "name", r.Name)

Expand All @@ -51,23 +51,23 @@ func (r *Spyt) Default() {

var _ webhook.Validator = &Spyt{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
func (r *Spyt) ValidateCreate() (admission.Warnings, error) {
spytlog.Info("validate create", "name", r.Name)

// TODO(user): fill in your validation logic upon object creation.
return nil, nil
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
func (r *Spyt) ValidateUpdate(old runtime.Object) (admission.Warnings, error) {
spytlog.Info("validate update", "name", r.Name)

// TODO(user): fill in your validation logic upon object update.
return nil, nil
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.
func (r *Spyt) ValidateDelete() (admission.Warnings, error) {
spytlog.Info("validate delete", "name", r.Name)

Expand Down
20 changes: 10 additions & 10 deletions api/v1/ytsaurus_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ type EmbeddedObjectMetadata struct {
}

// LocationType string describes types of disk locations for YT components.
// +enum
// +enum.
type LocationType string

const (
Expand All @@ -95,7 +95,7 @@ type LocationSpec struct {
}

// LogLevel string describes possible Ytsaurus logging level.
// +enum
// +enum.
type LogLevel string

const (
Expand All @@ -107,7 +107,7 @@ const (
)

// LogWriterType string describes types of possible log writers.
// +enum
// +enum.
type LogWriterType string

const (
Expand All @@ -132,7 +132,7 @@ const (
)

// CategoriesFilterType string describes types of possible log CategoriesFilter.
// +enum
// +enum.
type CategoriesFilterType string

const (
Expand Down Expand Up @@ -565,7 +565,7 @@ type CommonSpec struct {
ImagePullSecrets []corev1.LocalObjectReference `json:"imagePullSecrets,omitempty"`
}

// YtsaurusSpec defines the desired state of Ytsaurus
// YtsaurusSpec defines the desired state of Ytsaurus.
type YtsaurusSpec struct {
CommonSpec `json:",inline"`
UIImage string `json:"uiImage,omitempty"`
Expand Down Expand Up @@ -669,9 +669,9 @@ const (
UpdateSelectorStatelessOnly UpdateSelector = "StatelessOnly"
// UpdateSelectorMasterOnly means that only master could be updated.
UpdateSelectorMasterOnly UpdateSelector = "MasterOnly"
// UpdateSelectorTabletNodesOnly means that only tablet nodes could be updated
// UpdateSelectorTabletNodesOnly means that only tablet nodes could be updated.
UpdateSelectorTabletNodesOnly UpdateSelector = "TabletNodesOnly"
// UpdateSelectorExecNodesOnly means that only tablet nodes could be updated
// UpdateSelectorExecNodesOnly means that only tablet nodes could be updated.
UpdateSelectorExecNodesOnly UpdateSelector = "ExecNodesOnly"
// UpdateSelectorEverything means that all components could be updated.
// With this setting and if master or tablet nodes need update all the components would be updated.
Expand Down Expand Up @@ -701,7 +701,7 @@ type UpdateStatus struct {
MasterMonitoringPaths []string `json:"masterMonitoringPaths,omitempty"`
}

// YtsaurusStatus defines the observed state of Ytsaurus
// YtsaurusStatus defines the observed state of Ytsaurus.
type YtsaurusStatus struct {
//+kubebuilder:default:=Created
State ClusterState `json:"state,omitempty"`
Expand Down Expand Up @@ -730,7 +730,7 @@ type YtsaurusStatus struct {
// +kubebuilder:resource:path=ytsaurus,shortName=yt
// +kubebuilder:subresource:status

// Ytsaurus is the Schema for the ytsaurus API
// Ytsaurus is the Schema for the ytsaurus API.
type Ytsaurus struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -740,7 +740,7 @@ type Ytsaurus struct {

//+kubebuilder:object:root=true

// YtsaurusList contains a list of Ytsaurus
// YtsaurusList contains a list of Ytsaurus.
type YtsaurusList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Expand Down
9 changes: 4 additions & 5 deletions api/v1/ytsaurus_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ func (r *Ytsaurus) SetupWebhookWithManager(mgr ctrl.Manager) error {

var _ webhook.Defaulter = &Ytsaurus{}

// Default implements webhook.Defaulter so a webhook will be registered for the type
// Default implements webhook.Defaulter so a webhook will be registered for the type.
func (r *Ytsaurus) Default() {
ytsauruslog.Info("default", "name", r.Name)

Expand Down Expand Up @@ -430,7 +430,6 @@ func (r *Ytsaurus) validateInstanceSpec(instanceSpec InstanceSpec, path *field.P

if instanceSpec.Locations != nil {
for locationIdx, location := range instanceSpec.Locations {

inVolumeMount := false
for _, volumeMount := range instanceSpec.VolumeMounts {
if strings.HasPrefix(location.Path, volumeMount.MountPath) {
Expand Down Expand Up @@ -484,14 +483,14 @@ func (r *Ytsaurus) evaluateYtsaurusValidation(old *Ytsaurus) error {
allErrors)
}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
// ValidateCreate implements webhook.Validator so a webhook will be registered for the type.
func (r *Ytsaurus) ValidateCreate() (admission.Warnings, error) {
ytsauruslog.Info("validate create", "name", r.Name)

return nil, r.evaluateYtsaurusValidation(nil)
}

// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type
// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type.
func (r *Ytsaurus) ValidateUpdate(oldObject runtime.Object) (admission.Warnings, error) {
ytsauruslog.Info("validate update", "name", r.Name)
old, ok := oldObject.(*Ytsaurus)
Expand All @@ -501,7 +500,7 @@ func (r *Ytsaurus) ValidateUpdate(oldObject runtime.Object) (admission.Warnings,
return nil, r.evaluateYtsaurusValidation(old)
}

// ValidateDelete implements webhook.Validator so a webhook will be registered for the type
// ValidateDelete implements webhook.Validator so a webhook will be registered for the type.
func (r *Ytsaurus) ValidateDelete() (admission.Warnings, error) {
ytsauruslog.Info("validate delete", "name", r.Name)

Expand Down
Loading

0 comments on commit 9784f6e

Please sign in to comment.