mirror of
https://github.com/k3s-io/kubernetes.git
synced 2025-08-10 04:27:54 +00:00
add comments
This commit is contained in:
parent
6419924a5e
commit
fb360bca98
@ -23,11 +23,14 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// TODO: We need to remove the GroupVersion in types.go. We use the name GroupAndVersion here temporarily.
|
// TODO: We need to remove the GroupVersion in types.go. We use the name GroupAndVersion here temporarily.
|
||||||
|
// GroupVersion contains the "group" and the "version", which uniquely identifies the API.
|
||||||
type GroupAndVersion struct {
|
type GroupAndVersion struct {
|
||||||
Group string
|
Group string
|
||||||
Version string
|
Version string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// String puts "group" and "version" into a single "group/version" string. For the legacy v1
|
||||||
|
// it returns "v1".
|
||||||
func (gv *GroupAndVersion) String() string {
|
func (gv *GroupAndVersion) String() string {
|
||||||
// special case of "v1" for backward compatibility
|
// special case of "v1" for backward compatibility
|
||||||
if gv.Group == "" && gv.Version == "v1" {
|
if gv.Group == "" && gv.Version == "v1" {
|
||||||
@ -37,6 +40,8 @@ func (gv *GroupAndVersion) String() string {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// ParseGroupVersion turns "group/version" string into a GroupVersion struct. It reports error
|
||||||
|
// if it cannot parse the string.
|
||||||
func ParseGroupVersion(gv string) (GroupAndVersion, error) {
|
func ParseGroupVersion(gv string) (GroupAndVersion, error) {
|
||||||
s := strings.Split(gv, "/")
|
s := strings.Split(gv, "/")
|
||||||
// "v1" is the only special case. Otherwise GroupVersion is expected to contain
|
// "v1" is the only special case. Otherwise GroupVersion is expected to contain
|
||||||
|
Loading…
Reference in New Issue
Block a user