Skip to content

Commit 1d661c1

Browse files
committed
echo
Signed-off-by: Richard Wall <[email protected]>
1 parent c87f7c3 commit 1d661c1

File tree

2 files changed

+3
-7
lines changed

2 files changed

+3
-7
lines changed

cmd/echo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ var echoCmd = &cobra.Command{
1111
Short: "starts an echo server to test the agent",
1212
Long: `The agent sends data to a server. This echo server
1313
can be used to act as the server part and echo the data received by the agent.`,
14-
Run: echo.Echo,
14+
RunE: echo.Echo,
1515
}
1616

1717
func init() {

pkg/echo/echo.go

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,16 @@ import (
99
"github.com/spf13/cobra"
1010

1111
"github.com/jetstack/preflight/api"
12-
"github.com/jetstack/preflight/pkg/logs"
1312
)
1413

1514
var EchoListen string
1615

1716
var Compact bool
1817

19-
func Echo(cmd *cobra.Command, args []string) {
18+
func Echo(cmd *cobra.Command, args []string) error {
2019
http.HandleFunc("/", echoHandler)
2120
fmt.Println("Listening to requests at ", EchoListen)
22-
err := http.ListenAndServe(EchoListen, nil)
23-
if err != nil {
24-
logs.Log.Fatal(err)
25-
}
21+
return http.ListenAndServe(EchoListen, nil)
2622
}
2723

2824
func echoHandler(w http.ResponseWriter, r *http.Request) {

0 commit comments

Comments
 (0)