From 4eb489a5a778600c78d68b6ac7f3f814ecad382b Mon Sep 17 00:00:00 2001 From: kobayashi Date: Mon, 28 Sep 2020 18:21:18 -0400 Subject: [PATCH] Rmove unused functions --- pkg/contexts/contexts.go | 17 ----------------- pkg/contexts/contexts_test.go | 10 ---------- pkg/reconciler/events/event.go | 19 ------------------- 3 files changed, 46 deletions(-) diff --git a/pkg/contexts/contexts.go b/pkg/contexts/contexts.go index ac8dfd1722d..b721edd3f48 100644 --- a/pkg/contexts/contexts.go +++ b/pkg/contexts/contexts.go @@ -18,23 +18,6 @@ package contexts import "context" -// hdcnKey is used as the key for associating information -// with a context.Context. -type hdcnKey struct{} - -// withDefaultConfigurationName notes on the context for nested validation -// that there is a default configuration name, which affects how an empty -// configurationName is validated. -func withDefaultConfigurationName(ctx context.Context) context.Context { - return context.WithValue(ctx, hdcnKey{}, struct{}{}) -} - -// hasDefaultConfigurationName checks to see whether the given context has -// been marked as having a default configurationName. -func hasDefaultConfigurationName(ctx context.Context) bool { - return ctx.Value(hdcnKey{}) != nil -} - // lemonadeKey is used as the key for associating information // with a context.Context. This variable doesn't really matter, so it's // a total random name (for history purpose, used lemonade as it was written diff --git a/pkg/contexts/contexts_test.go b/pkg/contexts/contexts_test.go index 73b2f1d40a8..8ce1fe25baf 100644 --- a/pkg/contexts/contexts_test.go +++ b/pkg/contexts/contexts_test.go @@ -29,16 +29,6 @@ func TestContexts(t *testing.T) { check func(context.Context) bool want bool }{{ - name: "has default config name", - ctx: withDefaultConfigurationName(ctx), - check: hasDefaultConfigurationName, - want: true, - }, { - name: "doesn't have default config name", - ctx: ctx, - check: hasDefaultConfigurationName, - want: false, - }, { name: "are upgrading via defaulting", ctx: WithUpgradeViaDefaulting(ctx), check: IsUpgradeViaDefaulting, diff --git a/pkg/reconciler/events/event.go b/pkg/reconciler/events/event.go index 9c0e4b106eb..24a96614405 100644 --- a/pkg/reconciler/events/event.go +++ b/pkg/reconciler/events/event.go @@ -105,22 +105,3 @@ func EmitError(c record.EventRecorder, err error, object runtime.Object) { c.Event(object, corev1.EventTypeWarning, EventReasonError, err.Error()) } } - -// emitEvent emits an event for object if afterCondition is different from beforeCondition -// -// Status "ConditionUnknown": -// beforeCondition == nil, emit EventReasonStarted -// beforeCondition != nil, emit afterCondition.Reason -// -// Status "ConditionTrue": emit EventReasonSucceded -// Status "ConditionFalse": emit EventReasonFailed -// Deprecated: use Emit -func emitEvent(ctx context.Context, beforeCondition *apis.Condition, afterCondition *apis.Condition, object runtime.Object) { - Emit(ctx, beforeCondition, afterCondition, object) -} - -// emitErrorEvent emits a failure associated to an error -// Deprecated: use EmitError instead -func emitErrorEvent(c record.EventRecorder, err error, object runtime.Object) { - EmitError(c, err, object) -}