Skip to content

Commit 2f5e859

Browse files
authored
Don't error on the default help command, or version (#72)
* Fix goroutines are asleep error We only want this behaviour in the "silent" command, and everything else should behave as normal. Signed-off-by: Gerhard Lazu <[email protected]> * Git ignore perfTest/perfTest binary Signed-off-by: Gerhard Lazu <[email protected]> * Remove rabbitmqBrokerUrl from the version command Not sure what that was doing there, but it didn't seem to belong. Signed-off-by: Gerhard Lazu <[email protected]>
1 parent e1c759f commit 2f5e859

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,5 @@ vet
2222
.vagrant/
2323
local/
2424
tls-gen/
25+
26+
perfTest/perfTest

perfTest/cmd/silent.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,24 @@ import (
1010
"github.com/spf13/cobra"
1111
"math/rand"
1212
"os"
13+
"sync"
1314
"sync/atomic"
1415
"time"
1516
)
1617

18+
var wg sync.WaitGroup
19+
1720
func newSilent() *cobra.Command {
1821
var silentCmd = &cobra.Command{
1922
Use: "silent",
2023
Short: "NewProducer a silent simulation",
2124
RunE: func(cmd *cobra.Command, args []string) error {
22-
return startSimulation()
25+
wg.Add(1)
26+
err := startSimulation()
27+
if err == nil {
28+
wg.Wait()
29+
}
30+
return err
2331
},
2432
}
2533
return silentCmd

perfTest/cmd/version.go

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

33
import (
44
"fmt"
5-
65
"github.com/spf13/cobra"
76
)
87

@@ -22,8 +21,7 @@ var versionCmd = &cobra.Command{
2221
}
2322

2423
func printVersion() {
25-
fmt.Printf("%s version: %s\ngo version: %s\ncommit: %s\n",
26-
rabbitmqBrokerUrl,
24+
fmt.Printf("version: %s\ngo version: %s\ncommit: %s\n",
2725
version,
2826
goVersion,
2927
commit,

perfTest/perftest.go

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,8 @@ package main
22

33
import (
44
"github.com/rabbitmq/rabbitmq-stream-go-client/perfTest/cmd"
5-
"sync"
65
)
76

8-
var wg sync.WaitGroup
9-
107
func main() {
11-
12-
wg.Add(1)
13-
go cmd.Execute()
14-
wg.Wait()
8+
cmd.Execute()
159
}

0 commit comments

Comments
 (0)