From 048e3166456acc476dd869b8702990938868d319 Mon Sep 17 00:00:00 2001 From: Matthew Hooker Date: Wed, 29 Mar 2017 12:44:42 -0700 Subject: [PATCH] s/TargettedUi/TargetedUI/ --- command/build.go | 4 ++-- packer/build.go | 4 ++-- packer/ui.go | 16 ++++++++-------- packer/ui_test.go | 10 +++++----- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/command/build.go b/command/build.go index d1f4b0c54..9e79326a4 100644 --- a/command/build.go +++ b/command/build.go @@ -212,7 +212,7 @@ func (c BuildCommand) Run(args []string) int { c.Ui.Error("\n==> Some builds didn't complete successfully and had errors:") for name, err := range errors { // Create a UI for the machine readable stuff to be targeted - ui := &packer.TargettedUi{ + ui := &packer.TargetedUI{ Target: name, Ui: c.Ui, } @@ -227,7 +227,7 @@ func (c BuildCommand) Run(args []string) int { c.Ui.Say("\n==> Builds finished. The artifacts of successful builds are:") for name, buildArtifacts := range artifacts.m { // Create a UI for the machine readable stuff to be targeted - ui := &packer.TargettedUi{ + ui := &packer.TargetedUI{ Target: name, Ui: c.Ui, } diff --git a/packer/build.go b/packer/build.go index dfc8bff7f..d14024b77 100644 --- a/packer/build.go +++ b/packer/build.go @@ -211,7 +211,7 @@ func (b *coreBuild) Run(originalUi Ui, cache Cache) ([]Artifact, error) { artifacts := make([]Artifact, 0, 1) // The builder just has a normal Ui, but targeted - builderUi := &TargettedUi{ + builderUi := &TargetedUI{ Target: b.Name(), Ui: originalUi, } @@ -236,7 +236,7 @@ PostProcessorRunSeqLoop: for _, ppSeq := range b.postProcessors { priorArtifact := builderArtifact for i, corePP := range ppSeq { - ppUi := &TargettedUi{ + ppUi := &TargetedUI{ Target: fmt.Sprintf("%s (%s)", b.Name(), corePP.processorType), Ui: originalUi, } diff --git a/packer/ui.go b/packer/ui.go index 7616eb7ac..c107c23b8 100644 --- a/packer/ui.go +++ b/packer/ui.go @@ -46,12 +46,12 @@ type ColoredUi struct { Ui Ui } -// TargettedUi is a UI that wraps another UI implementation and modifies +// TargetedUI is a UI that wraps another UI implementation and modifies // the output to indicate a specific target. Specifically, all Say output // is prefixed with the target name. Message output is not prefixed but // is offset by the length of the target so that output is lined up properly // with Say output. Machine-readable output has the proper target set. -type TargettedUi struct { +type TargetedUI struct { Target string Ui Ui } @@ -132,28 +132,28 @@ func (u *ColoredUi) supportsColors() bool { return cygwin } -func (u *TargettedUi) Ask(query string) (string, error) { +func (u *TargetedUI) Ask(query string) (string, error) { return u.Ui.Ask(u.prefixLines(true, query)) } -func (u *TargettedUi) Say(message string) { +func (u *TargetedUI) Say(message string) { u.Ui.Say(u.prefixLines(true, message)) } -func (u *TargettedUi) Message(message string) { +func (u *TargetedUI) Message(message string) { u.Ui.Message(u.prefixLines(false, message)) } -func (u *TargettedUi) Error(message string) { +func (u *TargetedUI) Error(message string) { u.Ui.Error(u.prefixLines(true, message)) } -func (u *TargettedUi) Machine(t string, args ...string) { +func (u *TargetedUI) Machine(t string, args ...string) { // Prefix in the target, then pass through u.Ui.Machine(fmt.Sprintf("%s,%s", u.Target, t), args...) } -func (u *TargettedUi) prefixLines(arrow bool, message string) string { +func (u *TargetedUI) prefixLines(arrow bool, message string) string { arrowText := "==>" if !arrow { arrowText = strings.Repeat(" ", len(arrowText)) diff --git a/packer/ui_test.go b/packer/ui_test.go index e65a7f3db..76d0cd5b5 100644 --- a/packer/ui_test.go +++ b/packer/ui_test.go @@ -97,9 +97,9 @@ func TestColoredUi_noColorEnv(t *testing.T) { } } -func TestTargettedUi(t *testing.T) { +func TestTargetedUI(t *testing.T) { bufferUi := testUi() - targettedUi := &TargettedUi{ + targettedUi := &TargetedUI{ Target: "foo", Ui: bufferUi, } @@ -142,11 +142,11 @@ func TestColoredUi_ImplUi(t *testing.T) { } } -func TestTargettedUi_ImplUi(t *testing.T) { +func TestTargetedUI_ImplUi(t *testing.T) { var raw interface{} - raw = &TargettedUi{} + raw = &TargetedUI{} if _, ok := raw.(Ui); !ok { - t.Fatalf("TargettedUi must implement Ui") + t.Fatalf("TargetedUI must implement Ui") } }