File tree Expand file tree Collapse file tree 1 file changed +14
-12
lines changed
Expand file tree Collapse file tree 1 file changed +14
-12
lines changed Original file line number Diff line number Diff line change @@ -65,9 +65,9 @@ func ParseKind(s string) Kind {
6565 return KindActive
6666 case "committed" :
6767 return KindCommitted
68+ default :
69+ return KindUnknown
6870 }
69-
70- return KindUnknown
7171}
7272
7373// String returns the string representation of the Kind
@@ -79,9 +79,9 @@ func (k Kind) String() string {
7979 return "Active"
8080 case KindCommitted :
8181 return "Committed"
82+ default :
83+ return "Unknown"
8284 }
83-
84- return "Unknown"
8585}
8686
8787// MarshalJSON the Kind to JSON
@@ -102,25 +102,27 @@ func (k *Kind) UnmarshalJSON(b []byte) error {
102102
103103// KindToProto converts from [Kind] to the protobuf definition [snapshots.Kind].
104104func KindToProto (kind Kind ) snapshotsapi.Kind {
105- if kind == KindActive {
105+ switch kind {
106+ case KindActive :
106107 return snapshotsapi .Kind_ACTIVE
107- }
108- if kind == KindView {
108+ case KindView :
109109 return snapshotsapi .Kind_VIEW
110+ default :
111+ return snapshotsapi .Kind_COMMITTED
110112 }
111- return snapshotsapi .Kind_COMMITTED
112113}
113114
114115// KindFromProto converts from the protobuf definition [snapshots.Kind] to
115116// [Kind].
116117func KindFromProto (kind snapshotsapi.Kind ) Kind {
117- if kind == snapshotsapi .Kind_ACTIVE {
118+ switch kind {
119+ case snapshotsapi .Kind_ACTIVE :
118120 return KindActive
119- }
120- if kind == snapshotsapi .Kind_VIEW {
121+ case snapshotsapi .Kind_VIEW :
121122 return KindView
123+ default :
124+ return KindCommitted
122125 }
123- return KindCommitted
124126}
125127
126128// Info provides information about a particular snapshot.
You can’t perform that action at this time.
0 commit comments