Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lint-fix does not fix fieldalignment: struct with 88 pointer bytes could be 80 (govet) #168

Open
kaovilai opened this issue Feb 6, 2025 · 0 comments

Comments

@kaovilai
Copy link
Member

kaovilai commented Feb 6, 2025

A rough fix is to run following

go run golang.org/x/tools/go/analysis/passes/fieldalignment/cmd/fieldalignment@latest -fix ./...

but it get rids of all the comments in structs.. including kubebuilder markers.. so undesirable.

Example of what it does

 // NonAdminRestoreStatus defines the observed state of NonAdminRestore
 type NonAdminRestoreStatus struct {
-	// +optional
-	VeleroRestore *VeleroRestore `json:"veleroRestore,omitempty"`
-
-	// queueInfo is used to estimate how many restores are scheduled before the given VeleroRestore in the OADP namespace.
-	// This number is not guaranteed to be accurate, but it should be close. It's inaccurate for cases when
-	// Velero pod is not running or being restarted after Restore object were created.
-	// It counts only VeleroRestores that are still subject to be handled by OADP/Velero.
-	// +optional
-	QueueInfo *QueueInfo `json:"queueInfo,omitempty"`
-
-	// phase is a simple one high-level summary of the lifecycle of an NonAdminRestore.
-	Phase NonAdminPhase `json:"phase,omitempty"`
-
-	Conditions []metav1.Condition `json:"conditions,omitempty"`
-
-	// logsPath is path to backup logs in the storage location
-	//
-	LogsPath string `json:"logsPath,omitempty"`
-
-	// resourceListPath is path to resource list of backup in storage location
-	ResourceListPath string `json:"resourceListPath,omitempty"`
+	VeleroRestore    *VeleroRestore     `json:"veleroRestore,omitempty"`
+	QueueInfo        *QueueInfo         `json:"queueInfo,omitempty"`
+	Phase            NonAdminPhase      `json:"phase,omitempty"`
+	LogsPath         string             `json:"logsPath,omitempty"`
+	ResourceListPath string             `json:"resourceListPath,omitempty"`
+	Conditions       []metav1.Condition `json:"conditions,omitempty"`
 }

So an alternative is needed.

@kaovilai kaovilai added cleanup help wanted Extra attention is needed newbie labels Feb 6, 2025
@shubham-pampattiwar shubham-pampattiwar moved this to Todo in OADP Feb 6, 2025
@weshayutin weshayutin moved this from Todo to New / Design in OADP Feb 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: New / Design
Development

No branches or pull requests

2 participants