Skip to content

Commit 531d3de

Browse files
committed
Merge pull request kubernetes#12482 from tmrts/refactor/iota
Refactor probe.Result enumeration
2 parents 11fcd3b + 16b4428 commit 531d3de

File tree

2 files changed

+5
-17
lines changed

2 files changed

+5
-17
lines changed

pkg/apiserver/validator_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ func TestValidate(t *testing.T) {
8989
t.Errorf("expected empty string, got %s", status)
9090
}
9191
if status != test.expectedStatus {
92-
t.Errorf("expected %s, got %s", test.expectedStatus.String(), status.String())
92+
t.Errorf("expected %s, got %s", test.expectedStatus, status)
9393
}
9494
}
9595
}

pkg/probe/probe.go

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,10 @@ limitations under the License.
1616

1717
package probe
1818

19-
type Result int
19+
type Result string
2020

21-
// Status values must be one of these constants.
2221
const (
23-
Success Result = iota
24-
Failure
25-
Unknown
22+
Success Result = "success"
23+
Failure Result = "failure"
24+
Unknown Result = "unknown"
2625
)
27-
28-
func (s Result) String() string {
29-
switch s {
30-
case Success:
31-
return "success"
32-
case Failure:
33-
return "failure"
34-
default:
35-
return "unknown"
36-
}
37-
}

0 commit comments

Comments
 (0)