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 {
65
65
return KindActive
66
66
case "committed" :
67
67
return KindCommitted
68
+ default :
69
+ return KindUnknown
68
70
}
69
-
70
- return KindUnknown
71
71
}
72
72
73
73
// String returns the string representation of the Kind
@@ -79,9 +79,9 @@ func (k Kind) String() string {
79
79
return "Active"
80
80
case KindCommitted :
81
81
return "Committed"
82
+ default :
83
+ return "Unknown"
82
84
}
83
-
84
- return "Unknown"
85
85
}
86
86
87
87
// MarshalJSON the Kind to JSON
@@ -102,25 +102,27 @@ func (k *Kind) UnmarshalJSON(b []byte) error {
102
102
103
103
// KindToProto converts from [Kind] to the protobuf definition [snapshots.Kind].
104
104
func KindToProto (kind Kind ) snapshotsapi.Kind {
105
- if kind == KindActive {
105
+ switch kind {
106
+ case KindActive :
106
107
return snapshotsapi .Kind_ACTIVE
107
- }
108
- if kind == KindView {
108
+ case KindView :
109
109
return snapshotsapi .Kind_VIEW
110
+ default :
111
+ return snapshotsapi .Kind_COMMITTED
110
112
}
111
- return snapshotsapi .Kind_COMMITTED
112
113
}
113
114
114
115
// KindFromProto converts from the protobuf definition [snapshots.Kind] to
115
116
// [Kind].
116
117
func KindFromProto (kind snapshotsapi.Kind ) Kind {
117
- if kind == snapshotsapi .Kind_ACTIVE {
118
+ switch kind {
119
+ case snapshotsapi .Kind_ACTIVE :
118
120
return KindActive
119
- }
120
- if kind == snapshotsapi .Kind_VIEW {
121
+ case snapshotsapi .Kind_VIEW :
121
122
return KindView
123
+ default :
124
+ return KindCommitted
122
125
}
123
- return KindCommitted
124
126
}
125
127
126
128
// Info provides information about a particular snapshot.
You can’t perform that action at this time.
0 commit comments