Skip to content

Commit 4c3ec5d

Browse files
authored
Add a line break to kubectl-moco start/stop command's message (#737)
Signed-off-by: Masayuki Ishii <[email protected]>
1 parent 3bb8fdb commit 4c3ec5d

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

cmd/kubectl-moco/cmd/start.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package cmd
33
import (
44
"context"
55
"fmt"
6-
"os"
76

87
mocov1beta2 "github.com/cybozu-go/moco/api/v1beta2"
98
"github.com/cybozu-go/moco/pkg/constants"
@@ -50,16 +49,15 @@ func startClustering(ctx context.Context, name string) error {
5049
}
5150

5251
if equality.Semantic.DeepEqual(orig, cluster) {
53-
fmt.Fprintf(os.Stdout, "The clustering is already running.")
52+
fmt.Println("The clustering is already running.")
5453
return nil
5554
}
5655

5756
if err := kubeClient.Update(ctx, cluster); err != nil {
5857
return fmt.Errorf("failed to start clustering of MySQLCluster: %w", err)
5958
}
6059

61-
fmt.Fprintf(os.Stdout, "started clustering of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))
62-
60+
fmt.Printf("started clustering of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))
6361
return nil
6462
}
6563

@@ -89,15 +87,14 @@ func startReconciliation(ctx context.Context, name string) error {
8987
}
9088

9189
if equality.Semantic.DeepEqual(orig, cluster) {
92-
fmt.Fprintf(os.Stdout, "The reconciliation is already running.")
90+
fmt.Println("The reconciliation is already running.")
9391
return nil
9492
}
9593

9694
if err := kubeClient.Update(ctx, cluster); err != nil {
9795
return fmt.Errorf("failed to start reconciliation of MySQLCluster: %w", err)
9896
}
9997

100-
fmt.Fprintf(os.Stdout, "started reconciliation of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))
101-
98+
fmt.Printf("started reconciliation of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))
10299
return nil
103100
}

cmd/kubectl-moco/cmd/stop.go

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package cmd
33
import (
44
"context"
55
"fmt"
6-
"os"
76

87
mocov1beta2 "github.com/cybozu-go/moco/api/v1beta2"
98
"github.com/cybozu-go/moco/pkg/constants"
@@ -51,16 +50,15 @@ func stopClustering(ctx context.Context, name string) error {
5150
cluster.Annotations[constants.AnnClusteringStopped] = "true"
5251

5352
if equality.Semantic.DeepEqual(orig, cluster) {
54-
fmt.Fprintf(os.Stdout, "The clustering is already stopped.")
53+
fmt.Println("The clustering is already stopped.")
5554
return nil
5655
}
5756

5857
if err := kubeClient.Update(ctx, cluster); err != nil {
5958
return fmt.Errorf("failed to stop clustering of MySQLCluster: %w", err)
6059
}
6160

62-
fmt.Fprintf(os.Stdout, "stopped clustering of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))
63-
61+
fmt.Printf("stopped clustering of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))
6462
return nil
6563
}
6664

@@ -91,15 +89,14 @@ func stopReconciliation(ctx context.Context, name string) error {
9189
cluster.Annotations[constants.AnnReconciliationStopped] = "true"
9290

9391
if equality.Semantic.DeepEqual(orig, cluster) {
94-
fmt.Fprintf(os.Stdout, "The reconciliation is already stopped.")
92+
fmt.Println("The reconciliation is already stopped.")
9593
return nil
9694
}
9795

9896
if err := kubeClient.Update(ctx, cluster); err != nil {
9997
return fmt.Errorf("failed to stop reconciliation of MySQLCluster: %w", err)
10098
}
10199

102-
fmt.Fprintf(os.Stdout, "stopped reconciliation of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))
103-
100+
fmt.Printf("stopped reconciliation of MySQLCluster %q\n", fmt.Sprintf("%s/%s", namespace, name))
104101
return nil
105102
}

0 commit comments

Comments
 (0)