Skip to content

Commit 10800f6

Browse files
committed
Use constant to replace integer literal
Signed-off-by: Hu Keping <hukeping@huawei.com>
1 parent 165815f commit 10800f6

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

ctr/checkpoint.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ func listCheckpoints(context *cli.Context) {
4343
id = context.Args().First()
4444
)
4545
if id == "" {
46-
fatal("container id cannot be empty", 1)
46+
fatal("container id cannot be empty", ExitStatusMissingArg)
4747
}
4848
resp, err := c.ListCheckpoint(netcontext.Background(), &types.ListCheckpointRequest{
4949
Id: id,
@@ -88,10 +88,10 @@ var createCheckpointCommand = cli.Command{
8888
name = context.Args().Get(1)
8989
)
9090
if containerID == "" {
91-
fatal("container id at cannot be empty", 1)
91+
fatal("container id at cannot be empty", ExitStatusMissingArg)
9292
}
9393
if name == "" {
94-
fatal("checkpoint name cannot be empty", 1)
94+
fatal("checkpoint name cannot be empty", ExitStatusMissingArg)
9595
}
9696
c := getClient(context)
9797
if _, err := c.CreateCheckpoint(netcontext.Background(), &types.CreateCheckpointRequest{
@@ -118,10 +118,10 @@ var deleteCheckpointCommand = cli.Command{
118118
name = context.Args().Get(1)
119119
)
120120
if containerID == "" {
121-
fatal("container id at cannot be empty", 1)
121+
fatal("container id at cannot be empty", ExitStatusMissingArg)
122122
}
123123
if name == "" {
124-
fatal("checkpoint name cannot be empty", 1)
124+
fatal("checkpoint name cannot be empty", ExitStatusMissingArg)
125125
}
126126
c := getClient(context)
127127
if _, err := c.DeleteCheckpoint(netcontext.Background(), &types.DeleteCheckpointRequest{

ctr/container.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ var startCommand = cli.Command{
146146
path = context.Args().Get(1)
147147
)
148148
if path == "" {
149-
fatal("bundle path cannot be empty", 1)
149+
fatal("bundle path cannot be empty", ExitStatusMissingArg)
150150
}
151151
if id == "" {
152-
fatal("container id cannot be empty", 1)
152+
fatal("container id cannot be empty", ExitStatusMissingArg)
153153
}
154154
bpath, err := filepath.Abs(path)
155155
if err != nil {
@@ -336,7 +336,7 @@ var pauseCommand = cli.Command{
336336
Action: func(context *cli.Context) {
337337
id := context.Args().First()
338338
if id == "" {
339-
fatal("container id cannot be empty", 1)
339+
fatal("container id cannot be empty", ExitStatusMissingArg)
340340
}
341341
c := getClient(context)
342342
_, err := c.UpdateContainer(netcontext.Background(), &types.UpdateContainerRequest{
@@ -356,7 +356,7 @@ var resumeCommand = cli.Command{
356356
Action: func(context *cli.Context) {
357357
id := context.Args().First()
358358
if id == "" {
359-
fatal("container id cannot be empty", 1)
359+
fatal("container id cannot be empty", ExitStatusMissingArg)
360360
}
361361
c := getClient(context)
362362
_, err := c.UpdateContainer(netcontext.Background(), &types.UpdateContainerRequest{
@@ -388,7 +388,7 @@ var killCommand = cli.Command{
388388
Action: func(context *cli.Context) {
389389
id := context.Args().First()
390390
if id == "" {
391-
fatal("container id cannot be empty", 1)
391+
fatal("container id cannot be empty", ExitStatusMissingArg)
392392
}
393393
c := getClient(context)
394394
if _, err := c.Signal(netcontext.Background(), &types.SignalRequest{

0 commit comments

Comments
 (0)