Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions pkg/ddc/base/runtime.go
Original file line number Diff line number Diff line change
Expand Up @@ -229,8 +229,19 @@ func GetMetadataListFromAnnotation(accessor metav1.ObjectMetaAccessor) (ret []da
return
}


// WithMetadataList returns a RuntimeInfoOption that sets the metadataList field
// on a RuntimeInfo instance.
//
// Parameters:
// - metadataList: a slice of Metadata objects to associate with the RuntimeInfo.
//
// Returns:
// - A RuntimeInfoOption function that, when applied, assigns the provided
// metadataList to info.metadataList and returns nil (no error).
func WithMetadataList(metadataList []datav1alpha1.Metadata) RuntimeInfoOption {
return func(info *RuntimeInfo) error {
// Assign the provided metadataList to the RuntimeInfo instance.
info.metadataList = metadataList
return nil
}
Comment on lines 231 to 247
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

There are two minor issues in this change:

  1. An extra empty line was introduced before the function documentation, which violates standard gofmt formatting (which collapses multiple empty lines).
  2. The inline comment // Assign the provided metadataList to the RuntimeInfo instance. is redundant as it merely restates what the code does.

We can clean this up by removing the extra empty line and the redundant inline comment.

// WithMetadataList returns a RuntimeInfoOption that sets the metadataList field
// on a RuntimeInfo instance.
//
// Parameters:
//   - metadataList: a slice of Metadata objects to associate with the RuntimeInfo.
//
// Returns:
//   - A RuntimeInfoOption function that, when applied, assigns the provided
//     metadataList to info.metadataList and returns nil (no error).
func WithMetadataList(metadataList []datav1alpha1.Metadata) RuntimeInfoOption {
	return func(info *RuntimeInfo) error {
		info.metadataList = metadataList
		return nil
	}
}

Expand Down