Skip to content

Commit d4576d2

Browse files
authored
fix: fix slice init length (#573)
1 parent 5247438 commit d4576d2

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

cmd/ipsw/cmd/download/download.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ func filterIPSWs(cmd *cobra.Command, macos bool) ([]download.IPSW, error) {
178178
}
179179

180180
unique := make(map[string]bool, len(filteredIPSWs))
181-
uniqueIPSWs := make([]download.IPSW, len(unique))
181+
uniqueIPSWs := make([]download.IPSW, 0, len(unique))
182182
for _, i := range filteredIPSWs {
183183
if len(i.URL) != 0 {
184184
if !unique[i.URL] {

internal/download/itunes.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ type ITunesVersionMaster struct {
6464

6565
// UniqueBuilds returns a slice with Builds with unique FirmwareURLs
6666
func UniqueBuilds(b []Build) []Build {
67-
unique := make(map[string]bool, len(b))
67+
unique := make(map[string]bool, 0, len(b))
6868
bs := make([]Build, len(unique))
6969
for _, elem := range b {
7070
if len(elem.URL) != 0 {

internal/download/ota.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -662,7 +662,7 @@ func (o *Ota) GetPallasOTAs() ([]types.Asset, error) {
662662

663663
func uniqueOTAs(otas []types.Asset) []types.Asset {
664664
unique := make(map[string]bool, len(otas))
665-
os := make([]types.Asset, len(unique))
665+
os := make([]types.Asset, 0, len(unique))
666666
for _, elem := range otas {
667667
if len(elem.BaseURL+elem.RelativePath) != 0 {
668668
if !unique[elem.BaseURL+elem.RelativePath] {

pkg/usb/apps/installation.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ func (c *Client) InstalledApps() ([]AppInfo, error) {
144144
return nil, err
145145
}
146146

147-
result := make([]AppInfo, len(apps))
147+
result := make([]AppInfo, 0, len(apps))
148148

149149
var app AppInfo
150150
if err := mapstructure.Decode(apps, &app); err != nil {

0 commit comments

Comments
 (0)