Skip to content

Commit 6ea8d9e

Browse files
committed
api: use string() instead of .String() for Stage, Status
1 parent 4c26752 commit 6ea8d9e

File tree

5 files changed

+11
-19
lines changed

5 files changed

+11
-19
lines changed

api/proposal.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,6 @@ var ValidStages = []Stage{
4444
StableStage,
4545
}
4646

47-
func (s Stage) String() string {
48-
return string(s)
49-
}
50-
5147
func (s Stage) IsValid() error {
5248
for _, s2 := range ValidStages {
5349
if s == s2 {
@@ -79,10 +75,6 @@ var ValidStatuses = []Status{
7975
ReplacedStatus,
8076
}
8177

82-
func (s Status) String() string {
83-
return string(s)
84-
}
85-
8678
func (s Status) IsValid() error {
8779
for _, s2 := range ValidStatuses {
8880
if s == s2 {

pkg/kepctl/commands/create.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ func addCreate(topLevel *cobra.Command) {
9090
&co.State,
9191
"state",
9292
"s",
93-
api.ProvisionalStatus.String(),
93+
string(api.ProvisionalStatus),
9494
"KEP State",
9595
)
9696

pkg/output/output.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,8 +210,8 @@ func DefaultPrintConfigs(names ...string) []PrintConfig {
210210

211211
return k.OwningSIG
212212
}},
213-
"Stage": {"Stage", func(k *api.Proposal) string { return k.Stage.String() }},
214-
"Status": {"Status", func(k *api.Proposal) string { return k.Status.String() }},
213+
"Stage": {"Stage", func(k *api.Proposal) string { return string(k.Stage) }},
214+
"Status": {"Status", func(k *api.Proposal) string { return string(k.Status) }},
215215
"Title": {"Title", func(k *api.Proposal) string {
216216
if k.PRNumber == "" {
217217
return k.Title

pkg/repo/query.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,10 +140,10 @@ func (r *Repo) Query(opts *QueryOpts) ([]*api.Proposal, error) {
140140

141141
logrus.Debugf("current KEP: %v", k)
142142

143-
if len(opts.Status) > 0 && !allowedStatus[k.Status.String()] {
143+
if len(opts.Status) > 0 && !allowedStatus[string(k.Status)] {
144144
continue
145145
}
146-
if len(opts.Stage) > 0 && !allowedStage[k.Stage.String()] {
146+
if len(opts.Stage) > 0 && !allowedStage[string(k.Stage)] {
147147
continue
148148
}
149149
if len(opts.PRRApprover) > 0 && !atLeastOne(k.PRRApprovers, allowedPRR) {

pkg/repo/query_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,8 @@ func TestQuery(t *testing.T) {
100100
name: "everything",
101101
queryOpts: repo.QueryOpts{
102102
Groups: []string{"sig-architecture"},
103-
Status: []string{api.ProvisionalStatus.String()},
104-
Stage: []string{api.AlphaStage.String()},
103+
Status: []string{string(api.ProvisionalStatus)},
104+
Stage: []string{string(api.AlphaStage)},
105105
// TODO: PRRApprover: []string{""},
106106
Author: []string{"@rjbez17"},
107107
Approver: []string{"@liggitt"},
@@ -137,7 +137,7 @@ func TestQuery(t *testing.T) {
137137
{
138138
name: "results",
139139
queryOpts: repo.QueryOpts{
140-
Status: []string{api.ProvisionalStatus.String()},
140+
Status: []string{string(api.ProvisionalStatus)},
141141
},
142142
kepNames: []string{
143143
"123-newstyle",
@@ -175,7 +175,7 @@ func TestQuery(t *testing.T) {
175175
{
176176
name: "alpha",
177177
queryOpts: repo.QueryOpts{
178-
Stage: []string{api.AlphaStage.String()},
178+
Stage: []string{string(api.AlphaStage)},
179179
},
180180
kepNames: []string{
181181
"123-newstyle",
@@ -185,7 +185,7 @@ func TestQuery(t *testing.T) {
185185
{
186186
name: "beta",
187187
queryOpts: repo.QueryOpts{
188-
Stage: []string{api.BetaStage.String()},
188+
Stage: []string{string(api.BetaStage)},
189189
},
190190
kepNames: []string{
191191
"404-question-not-found",
@@ -194,7 +194,7 @@ func TestQuery(t *testing.T) {
194194
{
195195
name: "stable",
196196
queryOpts: repo.QueryOpts{
197-
Stage: []string{api.StableStage.String()},
197+
Stage: []string{string(api.StableStage)},
198198
},
199199
kepNames: []string{
200200
"13-keps-as-crds",

0 commit comments

Comments
 (0)