From d1f04c2479c792d15e420255d5c6829fdd95766c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=93=9D=E5=AE=9D=E7=9F=B3=E7=9A=84=E5=82=BB=E8=AF=9D?= Date: Fri, 20 Oct 2023 23:10:16 +0800 Subject: [PATCH] Add code comments MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 蓝宝石的傻话 --- pkg/options/types.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/options/types.go b/pkg/options/types.go index d7a9b5b185..9f03ec863b 100644 --- a/pkg/options/types.go +++ b/pkg/options/types.go @@ -108,6 +108,7 @@ func (r *ResourceSet) Type() string { // NodeType represents a nodeName to query from. type NodeType map[string]struct{} +// Set converts a comma-separated string of nodename into a slice and appends it to the NodeList func (n *NodeType) Set(value string) error { s := *n cols := strings.Split(value, ",") @@ -120,6 +121,7 @@ func (n *NodeType) Set(value string) error { return nil } +// AsSlice returns the LabelsAllowList in the form of plain string slice. func (n NodeType) AsSlice() []string { cols := make([]string, 0, len(n)) for col := range n { @@ -132,6 +134,7 @@ func (n NodeType) String() string { return strings.Join(n.AsSlice(), ",") } +// Type returns a descriptive string about the NodeList type. func (n *NodeType) Type() string { return "string" } @@ -150,6 +153,7 @@ func (n *NodeType) GetNodeFieldSelector() string { } +// NodeValue represents a nodeName to query from. type NodeValue interface { GetNodeFieldSelector() string }