Skip to content
This repository has been archived by the owner on May 3, 2022. It is now read-only.

Commit

Permalink
Use provided writer with Fprintf in place of fmt.Printf (#603)
Browse files Browse the repository at this point in the history
  • Loading branch information
cbrit authored and technosophos committed Jan 14, 2019
1 parent f4ced4a commit b61da54
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion cmd/duffle/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ Credentials and parameters may be passed to the bundle during a target action.
Action: target,
}

fmt.Printf("Executing custom action %q for release %q", target, claimName)
fmt.Fprintf(w, "Executing custom action %q for release %q", target, claimName)
err = action.Run(&c, creds, cmd.OutOrStdout())
if actionDef := c.Bundle.Actions[target]; !actionDef.Modifies {
// Do not store a claim for non-mutating actions.
Expand Down
24 changes: 12 additions & 12 deletions pkg/ohai/ohai.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,18 @@ import (
)

// Ohai displays an informative message.
func Ohai(a ...interface{}) (int, error) {
return Ohaif("%s", a...)
func Ohai(w io.Writer, a ...interface{}) (int, error) {
return Ohaif(w, "%s", a...)
}

// Ohaif displays an informative message.
func Ohaif(format string, a ...interface{}) (int, error) {
return fmt.Printf(fmt.Sprintf("==> %s", format), a...)
func Ohaif(w io.Writer, format string, a ...interface{}) (int, error) {
return fmt.Fprintf(w, fmt.Sprintf("==> %s", format), a...)
}

// Ohailn displays an informative message.
func Ohailn(a ...interface{}) (int, error) {
return Ohaif("%s\n", a...)
func Ohailn(w io.Writer, a ...interface{}) (int, error) {
return Ohaif(w, "%s\n", a...)
}

// Fohai displays an informative message.
Expand All @@ -36,18 +36,18 @@ func Fohailn(w io.Writer, a ...interface{}) (int, error) {
}

// Success displays a success message.
func Success(a ...interface{}) (int, error) {
return Successf("%s", a...)
func Success(w io.Writer, a ...interface{}) (int, error) {
return Successf(w, "%s", a...)
}

// Successf displays a success message.
func Successf(format string, a ...interface{}) (int, error) {
return fmt.Printf(fmt.Sprintf("✓✓✓ %s", format), a...)
func Successf(w io.Writer, format string, a ...interface{}) (int, error) {
return fmt.Fprintf(w, fmt.Sprintf("✓✓✓ %s", format), a...)
}

// Successln displays a success message.
func Successln(a ...interface{}) (int, error) {
return Successf("%s\n", a...)
func Successln(w io.Writer, a ...interface{}) (int, error) {
return Successf(w, "%s\n", a...)
}

// Fsuccess displays an informative message.
Expand Down

0 comments on commit b61da54

Please sign in to comment.