From a16dbf37476cff06cd0b05ee202799daac96d5a8 Mon Sep 17 00:00:00 2001 From: John Gardiner Myers Date: Sun, 18 Dec 2022 13:44:23 -0800 Subject: [PATCH] Make some functions private --- upup/pkg/fi/context.go | 6 +++--- upup/pkg/fi/default_methods.go | 8 ++++---- upup/pkg/fi/dryrun_target.go | 6 +++--- upup/pkg/fi/dryruntarget_test.go | 2 +- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/upup/pkg/fi/context.go b/upup/pkg/fi/context.go index 6f0f426c17..96428971c4 100644 --- a/upup/pkg/fi/context.go +++ b/upup/pkg/fi/context.go @@ -69,7 +69,7 @@ type Warning[T SubContext] struct { Message string } -func NewContext[T SubContext](ctx context.Context, target Target[T], cluster *kops.Cluster, keystore Keystore, secretStore SecretStore, checkExisting bool, sub T, tasks map[string]Task[T]) (*Context[T], error) { +func newContext[T SubContext](ctx context.Context, target Target[T], cluster *kops.Cluster, keystore Keystore, secretStore SecretStore, checkExisting bool, sub T, tasks map[string]Task[T]) (*Context[T], error) { c := &Context[T]{ ctx: ctx, Cluster: cluster, @@ -86,7 +86,7 @@ func NewContext[T SubContext](ctx context.Context, target Target[T], cluster *ko func NewNodeupContext(ctx context.Context, target NodeupTarget, cluster *kops.Cluster, keystore Keystore, secretStore SecretStore, checkExisting bool, tasks map[string]NodeupTask) (*NodeupContext, error) { sub := NodeupSubContext{} - return NewContext[NodeupSubContext](ctx, target, cluster, keystore, secretStore, checkExisting, sub, tasks) + return newContext[NodeupSubContext](ctx, target, cluster, keystore, secretStore, checkExisting, sub, tasks) } func NewCloudupContext(ctx context.Context, target CloudupTarget, cluster *kops.Cluster, cloud Cloud, keystore Keystore, secretStore SecretStore, clusterConfigBase vfs.Path, checkExisting bool, tasks map[string]CloudupTask) (*CloudupContext, error) { @@ -94,7 +94,7 @@ func NewCloudupContext(ctx context.Context, target CloudupTarget, cluster *kops. Cloud: cloud, ClusterConfigBase: clusterConfigBase, } - return NewContext[CloudupSubContext](ctx, target, cluster, keystore, secretStore, checkExisting, sub, tasks) + return newContext[CloudupSubContext](ctx, target, cluster, keystore, secretStore, checkExisting, sub, tasks) } func (c *Context[T]) AllTasks() map[string]Task[T] { diff --git a/upup/pkg/fi/default_methods.go b/upup/pkg/fi/default_methods.go index 4b8746717d..656047f3ed 100644 --- a/upup/pkg/fi/default_methods.go +++ b/upup/pkg/fi/default_methods.go @@ -26,18 +26,18 @@ import ( // NodeupDefaultDeltaRunMethod implements the standard change-based run procedure: // find the existing item; compare properties; call render with (actual, expected, changes) func NodeupDefaultDeltaRunMethod(e NodeupTask, c *NodeupContext) error { - return DefaultDeltaRunMethod[NodeupSubContext](e, c) + return defaultDeltaRunMethod[NodeupSubContext](e, c) } // CloudupDefaultDeltaRunMethod implements the standard change-based run procedure: // find the existing item; compare properties; call render with (actual, expected, changes) func CloudupDefaultDeltaRunMethod(e CloudupTask, c *CloudupContext) error { - return DefaultDeltaRunMethod[CloudupSubContext](e, c) + return defaultDeltaRunMethod[CloudupSubContext](e, c) } -// DefaultDeltaRunMethod implements the standard change-based run procedure: +// defaultDeltaRunMethod implements the standard change-based run procedure: // find the existing item; compare properties; call render with (actual, expected, changes) -func DefaultDeltaRunMethod[T SubContext](e Task[T], c *Context[T]) error { +func defaultDeltaRunMethod[T SubContext](e Task[T], c *Context[T]) error { var a Task[T] var err error diff --git a/upup/pkg/fi/dryrun_target.go b/upup/pkg/fi/dryrun_target.go index 42dcb7c893..7e83137ded 100644 --- a/upup/pkg/fi/dryrun_target.go +++ b/upup/pkg/fi/dryrun_target.go @@ -77,7 +77,7 @@ func (a DeletionByTaskName[T]) Less(i, j int) bool { var _ Target[CloudupSubContext] = &DryRunTarget[CloudupSubContext]{} -func NewDryRunTarget[T SubContext](assetBuilder *assets.AssetBuilder, out io.Writer) *DryRunTarget[T] { +func newDryRunTarget[T SubContext](assetBuilder *assets.AssetBuilder, out io.Writer) *DryRunTarget[T] { t := &DryRunTarget[T]{} t.out = out t.assetBuilder = assetBuilder @@ -85,11 +85,11 @@ func NewDryRunTarget[T SubContext](assetBuilder *assets.AssetBuilder, out io.Wri } func NewCloudupDryRunTarget(assetBuilder *assets.AssetBuilder, out io.Writer) *CloudupDryRunTarget { - return NewDryRunTarget[CloudupSubContext](assetBuilder, out) + return newDryRunTarget[CloudupSubContext](assetBuilder, out) } func NewNodeupDryRunTarget(assetBuilder *assets.AssetBuilder, out io.Writer) *NodeupDryRunTarget { - return NewDryRunTarget[NodeupSubContext](assetBuilder, out) + return newDryRunTarget[NodeupSubContext](assetBuilder, out) } func (t *DryRunTarget[T]) ProcessDeletions() bool { diff --git a/upup/pkg/fi/dryruntarget_test.go b/upup/pkg/fi/dryruntarget_test.go index fa9e975694..07724367fa 100644 --- a/upup/pkg/fi/dryruntarget_test.go +++ b/upup/pkg/fi/dryruntarget_test.go @@ -73,7 +73,7 @@ func Test_DryrunTarget_PrintReport(t *testing.T) { }, }, false) var stdout bytes.Buffer - target := NewDryRunTarget[CloudupSubContext](builder, &stdout) + target := newDryRunTarget[CloudupSubContext](builder, &stdout) tasks := map[string]CloudupTask{} a := &testTask{ Name: PtrTo("TestName"),