From fcfe02da77d0978e5fee7d847018141d30162a93 Mon Sep 17 00:00:00 2001 From: cui fliter Date: Fri, 4 Oct 2024 19:06:57 +0800 Subject: [PATCH] fix: fix slice init length --- 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 2d8bda9bee..6edbd82cc4 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 f85cca623a..0a16c67be0 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 {