Skip to content
This repository was archived by the owner on Jul 18, 2025. It is now read-only.

Commit 59049dd

Browse files
author
Jean-Christophe Sirot
committed
Ensure that all info an error messages are printed on os.Stdout and os.Stderr
Signed-off-by: Jean-Christophe Sirot <[email protected]>
1 parent f103660 commit 59049dd

File tree

5 files changed

+10
-8
lines changed

5 files changed

+10
-8
lines changed

e2e/testdata/init-output.golden

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
You will need to edit parameters.yml to fill in default values.
21
Created "app-test.dockerapp"
2+
You will need to edit parameters.yml to fill in default values.

internal/commands/bundle.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import (
66
"encoding/json"
77
"fmt"
88
"io/ioutil"
9+
"os"
910

1011
"github.com/deislabs/cnab-go/bundle"
1112
"github.com/docker/app/internal/packager"
@@ -61,7 +62,7 @@ func runBundle(dockerCli command.Cli, appName string, opts bundleOptions) error
6162
return err
6263
}
6364

64-
fmt.Fprintf(dockerCli.Out(), "Invocation image %q successfully built\n", bundle.InvocationImages[0].Image)
65+
fmt.Fprintf(os.Stdout, "Invocation image %q successfully built\n", bundle.InvocationImages[0].Image)
6566
bundleBytes, err := json.MarshalIndent(bundle, "", "\t")
6667
if err != nil {
6768
return err

internal/commands/root.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func addCommands(cmd *cobra.Command, dockerCli command.Cli) {
3333
mergeCmd(dockerCli),
3434
renderCmd(dockerCli),
3535
splitCmd(),
36-
validateCmd(dockerCli),
36+
validateCmd(),
3737
versionCmd(dockerCli),
3838
completionCmd(dockerCli, cmd),
3939
bundleCmd(dockerCli),

internal/commands/validate.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ package commands
22

33
import (
44
"fmt"
5+
"os"
56

67
"github.com/docker/app/internal/packager"
78
"github.com/docker/app/render"
89
"github.com/docker/app/types"
910
"github.com/docker/cli/cli"
10-
"github.com/docker/cli/cli/command"
1111
cliopts "github.com/docker/cli/opts"
1212
"github.com/spf13/cobra"
1313
)
@@ -16,7 +16,7 @@ type validateOptions struct {
1616
parametersOptions
1717
}
1818

19-
func validateCmd(dockerCli command.Cli) *cobra.Command {
19+
func validateCmd() *cobra.Command {
2020
var opts validateOptions
2121
cmd := &cobra.Command{
2222
Use: "validate [APP_NAME] [--set KEY=VALUE ...] [--parameters-file PARAMETERS_FILE]",
@@ -35,7 +35,7 @@ func validateCmd(dockerCli command.Cli) *cobra.Command {
3535
if err != nil {
3636
return err
3737
}
38-
fmt.Fprintf(dockerCli.Out(), "Validated %q\n", app.Path)
38+
fmt.Fprintf(os.Stdout, "Validated %q\n", app.Path)
3939
return nil
4040
},
4141
}

internal/commands/version.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package commands
22

33
import (
44
"fmt"
5+
"os"
56

67
"github.com/docker/app/internal"
78
"github.com/docker/app/internal/packager"
@@ -25,9 +26,9 @@ In order to be able to build an invocation images when using docker app from an
2526
Run: func(cmd *cobra.Command, args []string) {
2627
image := packager.BaseInvocationImage(dockerCli)
2728
if onlyBaseImage {
28-
fmt.Fprintln(dockerCli.Out(), image)
29+
fmt.Fprintln(os.Stdout, image)
2930
} else {
30-
fmt.Fprintln(dockerCli.Out(), internal.FullVersion(image))
31+
fmt.Fprintln(os.Stdout, internal.FullVersion(image))
3132
}
3233
},
3334
}

0 commit comments

Comments
 (0)