From 5e2cd1d04aa7cb169a18ead41ae467ca3065d558 Mon Sep 17 00:00:00 2001 From: cui fliter Date: Wed, 23 Oct 2024 19:18:41 +0800 Subject: [PATCH] fix: fix slice init length (#4412) Co-authored-by: CoderZhi Co-authored-by: Chen Chen --- ioctl/cmd/ws/wsdeviceapprove.go | 2 +- ioctl/cmd/ws/wsdeviceunapprove.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/ioctl/cmd/ws/wsdeviceapprove.go b/ioctl/cmd/ws/wsdeviceapprove.go index d80b13fe6f..529f980e66 100644 --- a/ioctl/cmd/ws/wsdeviceapprove.go +++ b/ioctl/cmd/ws/wsdeviceapprove.go @@ -61,7 +61,7 @@ func approveProjectDevice(projectID uint64, devices string) (string, error) { deviceArr = strings.Split(devices, ",") } - deviceAddress := make([]common.Address, len(deviceArr)) + deviceAddress := make([]common.Address, 0, len(deviceArr)) for _, device := range deviceArr { addr, err := address.FromString(device) if err != nil { diff --git a/ioctl/cmd/ws/wsdeviceunapprove.go b/ioctl/cmd/ws/wsdeviceunapprove.go index 850bf98a33..a072f6d504 100644 --- a/ioctl/cmd/ws/wsdeviceunapprove.go +++ b/ioctl/cmd/ws/wsdeviceunapprove.go @@ -61,7 +61,7 @@ func unapproveProjectDevice(projectID uint64, devices string) (string, error) { deviceArr = strings.Split(devices, ",") } - deviceAddress := make([]common.Address, len(deviceArr)) + deviceAddress := make([]common.Address, 0, len(deviceArr)) for _, device := range deviceArr { addr, err := address.FromString(device) if err != nil {