Skip to content

Commit

Permalink
feat: improve slice init
Browse files Browse the repository at this point in the history
  • Loading branch information
Fuochi committed Jan 26, 2023
1 parent ef428d2 commit 4a20f86
Show file tree
Hide file tree
Showing 57 changed files with 57 additions and 114 deletions.
3 changes: 1 addition & 2 deletions internal/provider/download_client_aria2_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,7 @@ func (d *DownloadClientAria2) write(ctx context.Context, downloadClient *radarr.
}

func (d *DownloadClientAria2) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/download_client_deluge_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ func (d *DownloadClientDeluge) write(ctx context.Context, downloadClient *radarr
}

func (d *DownloadClientDeluge) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/download_client_flood_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,7 @@ func (d *DownloadClientFlood) write(ctx context.Context, downloadClient *radarr.
}

func (d *DownloadClientFlood) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/download_client_freebox_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -337,8 +337,7 @@ func (d *DownloadClientFreebox) write(ctx context.Context, downloadClient *radar
}

func (d *DownloadClientFreebox) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/download_client_hadouken_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,7 @@ func (d *DownloadClientHadouken) write(ctx context.Context, downloadClient *rada
}

func (d *DownloadClientHadouken) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/download_client_nzbget_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,7 @@ func (d *DownloadClientNzbget) write(ctx context.Context, downloadClient *radarr
}

func (d *DownloadClientNzbget) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/download_client_nzbvortex_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -315,8 +315,7 @@ func (d *DownloadClientNzbvortex) write(ctx context.Context, downloadClient *rad
}

func (d *DownloadClientNzbvortex) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/download_client_pneumatic_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,7 @@ func (d *DownloadClientPneumatic) write(ctx context.Context, downloadClient *rad
}

func (d *DownloadClientPneumatic) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/download_client_qbittorrent_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,7 @@ func (d *DownloadClientQbittorrent) write(ctx context.Context, downloadClient *r
}

func (d *DownloadClientQbittorrent) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/download_client_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -550,8 +550,7 @@ func (d *DownloadClient) writeFields(ctx context.Context, fields []*radarr.Field
}

func (d *DownloadClient) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/download_client_rtorrent_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,7 @@ func (d *DownloadClientRtorrent) write(ctx context.Context, downloadClient *rada
}

func (d *DownloadClientRtorrent) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/download_client_sabnzbd_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,8 +334,7 @@ func (d *DownloadClientSabnzbd) write(ctx context.Context, downloadClient *radar
}

func (d *DownloadClientSabnzbd) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,7 @@ func (d *DownloadClientTorrentBlackhole) write(ctx context.Context, downloadClie
}

func (d *DownloadClientTorrentBlackhole) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,7 @@ func (d *DownloadClientTorrentDownloadStation) write(ctx context.Context, downlo
}

func (d *DownloadClientTorrentDownloadStation) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/download_client_transmission_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,8 +342,7 @@ func (d *DownloadClientTransmission) write(ctx context.Context, downloadClient *
}

func (d *DownloadClientTransmission) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,8 +258,7 @@ func (d *DownloadClientUsenetBlackhole) write(ctx context.Context, downloadClien
}

func (d *DownloadClientUsenetBlackhole) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,7 @@ func (d *DownloadClientUsenetDownloadStation) write(ctx context.Context, downloa
}

func (d *DownloadClientUsenetDownloadStation) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/download_client_utorrent_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,7 @@ func (d *DownloadClientUtorrent) write(ctx context.Context, downloadClient *rada
}

func (d *DownloadClientUtorrent) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/download_client_vuze_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,7 @@ func (d *DownloadClientVuze) write(ctx context.Context, downloadClient *radarr.D
}

func (d *DownloadClientVuze) read(ctx context.Context) *radarr.DownloadClientResource {
var tags []*int32

tags := make([]*int32, len(d.Tags.Elements()))
tfsdk.ValueAs(ctx, d.Tags, &tags)

client := radarr.NewDownloadClientResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/indexer_filelist_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,8 +328,7 @@ func (i *IndexerFilelist) write(ctx context.Context, indexer *radarr.IndexerReso
}

func (i *IndexerFilelist) read(ctx context.Context) *radarr.IndexerResource {
var tags []*int32

tags := make([]*int32, len(i.Tags.Elements()))
tfsdk.ValueAs(ctx, i.Tags, &tags)

indexer := radarr.NewIndexerResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/indexer_hdbits_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,8 +346,7 @@ func (i *IndexerHdbits) write(ctx context.Context, indexer *radarr.IndexerResour
}

func (i *IndexerHdbits) read(ctx context.Context) *radarr.IndexerResource {
var tags []*int32

tags := make([]*int32, len(i.Tags.Elements()))
tfsdk.ValueAs(ctx, i.Tags, &tags)

indexer := radarr.NewIndexerResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/indexer_iptorrents_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,7 @@ func (i *IndexerIptorrents) write(ctx context.Context, indexer *radarr.IndexerRe
}

func (i *IndexerIptorrents) read(ctx context.Context) *radarr.IndexerResource {
var tags []*int32

tags := make([]*int32, len(i.Tags.Elements()))
tfsdk.ValueAs(ctx, i.Tags, &tags)

indexer := radarr.NewIndexerResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/indexer_newznab_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,7 @@ func (i *IndexerNewznab) write(ctx context.Context, indexer *radarr.IndexerResou
}

func (i *IndexerNewznab) read(ctx context.Context) *radarr.IndexerResource {
var tags []*int32

tags := make([]*int32, len(i.Tags.Elements()))
tfsdk.ValueAs(ctx, i.Tags, &tags)

indexer := radarr.NewIndexerResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/indexer_nyaa_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -311,8 +311,7 @@ func (i *IndexerNyaa) write(ctx context.Context, indexer *radarr.IndexerResource
}

func (i *IndexerNyaa) read(ctx context.Context) *radarr.IndexerResource {
var tags []*int32

tags := make([]*int32, len(i.Tags.Elements()))
tfsdk.ValueAs(ctx, i.Tags, &tags)

indexer := radarr.NewIndexerResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/indexer_omgwtfnzbs_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,7 @@ func (i *IndexerOmgwtfnzbs) write(ctx context.Context, indexer *radarr.IndexerRe
}

func (i *IndexerOmgwtfnzbs) read(ctx context.Context) *radarr.IndexerResource {
var tags []*int32

tags := make([]*int32, len(i.Tags.Elements()))
tfsdk.ValueAs(ctx, i.Tags, &tags)

indexer := radarr.NewIndexerResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/indexer_pass_the_popcorn_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,7 @@ func (i *IndexerPassThePopcorn) write(ctx context.Context, indexer *radarr.Index
}

func (i *IndexerPassThePopcorn) read(ctx context.Context) *radarr.IndexerResource {
var tags []*int32

tags := make([]*int32, len(i.Tags.Elements()))
tfsdk.ValueAs(ctx, i.Tags, &tags)

indexer := radarr.NewIndexerResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/indexer_rarbg_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,7 @@ func (i *IndexerRarbg) write(ctx context.Context, indexer *radarr.IndexerResourc
}

func (i *IndexerRarbg) read(ctx context.Context) *radarr.IndexerResource {
var tags []*int32

tags := make([]*int32, len(i.Tags.Elements()))
tfsdk.ValueAs(ctx, i.Tags, &tags)

indexer := radarr.NewIndexerResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/indexer_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -441,8 +441,7 @@ func (i *Indexer) writeFields(ctx context.Context, fields []*radarr.Field) {
}

func (i *Indexer) read(ctx context.Context) *radarr.IndexerResource {
var tags []*int32

tags := make([]*int32, len(i.Tags.Elements()))
tfsdk.ValueAs(ctx, i.Tags, &tags)

indexer := radarr.NewIndexerResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/indexer_torrent_potato_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -320,8 +320,7 @@ func (i *IndexerTorrentPotato) write(ctx context.Context, indexer *radarr.Indexe
}

func (i *IndexerTorrentPotato) read(ctx context.Context) *radarr.IndexerResource {
var tags []*int32

tags := make([]*int32, len(i.Tags.Elements()))
tfsdk.ValueAs(ctx, i.Tags, &tags)

indexer := radarr.NewIndexerResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/indexer_torrent_rss_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -301,8 +301,7 @@ func (i *IndexerTorrentRss) write(ctx context.Context, indexer *radarr.IndexerRe
}

func (i *IndexerTorrentRss) read(ctx context.Context) *radarr.IndexerResource {
var tags []*int32

tags := make([]*int32, len(i.Tags.Elements()))
tfsdk.ValueAs(ctx, i.Tags, &tags)

indexer := radarr.NewIndexerResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/indexer_torznab_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,7 @@ func (i *IndexerTorznab) write(ctx context.Context, indexer *radarr.IndexerResou
}

func (i *IndexerTorznab) read(ctx context.Context) *radarr.IndexerResource {
var tags []*int32

tags := make([]*int32, len(i.Tags.Elements()))
tfsdk.ValueAs(ctx, i.Tags, &tags)

indexer := radarr.NewIndexerResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/movie_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,7 @@ func (m *Movie) write(ctx context.Context, movie *radarr.MovieResource) {
}

func (m *Movie) read(ctx context.Context) *radarr.MovieResource {
var tags []*int32

tags := make([]*int32, len(m.Tags.Elements()))
tfsdk.ValueAs(ctx, m.Tags, &tags)

movie := radarr.NewMovieResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/notification_boxcar_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -304,8 +304,7 @@ func (n *NotificationBoxcar) write(ctx context.Context, notification *radarr.Not
}

func (n *NotificationBoxcar) read(ctx context.Context) *radarr.NotificationResource {
var tags []*int32

tags := make([]*int32, len(n.Tags.Elements()))
tfsdk.ValueAs(ctx, n.Tags, &tags)

notification := radarr.NewNotificationResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/notification_custom_script_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,7 @@ func (n *NotificationCustomScript) write(ctx context.Context, notification *rada
}

func (n *NotificationCustomScript) read(ctx context.Context) *radarr.NotificationResource {
var tags []*int32

tags := make([]*int32, len(n.Tags.Elements()))
tfsdk.ValueAs(ctx, n.Tags, &tags)

notification := radarr.NewNotificationResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/notification_discord_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,8 +345,7 @@ func (n *NotificationDiscord) write(ctx context.Context, notification *radarr.No
}

func (n *NotificationDiscord) read(ctx context.Context) *radarr.NotificationResource {
var tags []*int32

tags := make([]*int32, len(n.Tags.Elements()))
tfsdk.ValueAs(ctx, n.Tags, &tags)

notification := radarr.NewNotificationResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/notification_email_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,7 @@ func (n *NotificationEmail) write(ctx context.Context, notification *radarr.Noti
}

func (n *NotificationEmail) read(ctx context.Context) *radarr.NotificationResource {
var tags []*int32

tags := make([]*int32, len(n.Tags.Elements()))
tfsdk.ValueAs(ctx, n.Tags, &tags)

notification := radarr.NewNotificationResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/notification_emby_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -352,8 +352,7 @@ func (n *NotificationEmby) write(ctx context.Context, notification *radarr.Notif
}

func (n *NotificationEmby) read(ctx context.Context) *radarr.NotificationResource {
var tags []*int32

tags := make([]*int32, len(n.Tags.Elements()))
tfsdk.ValueAs(ctx, n.Tags, &tags)

notification := radarr.NewNotificationResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/notification_gotify_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,7 @@ func (n *NotificationGotify) write(ctx context.Context, notification *radarr.Not
}

func (n *NotificationGotify) read(ctx context.Context) *radarr.NotificationResource {
var tags []*int32

tags := make([]*int32, len(n.Tags.Elements()))
tfsdk.ValueAs(ctx, n.Tags, &tags)

notification := radarr.NewNotificationResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/notification_join_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,8 +324,7 @@ func (n *NotificationJoin) write(ctx context.Context, notification *radarr.Notif
}

func (n *NotificationJoin) read(ctx context.Context) *radarr.NotificationResource {
var tags []*int32

tags := make([]*int32, len(n.Tags.Elements()))
tfsdk.ValueAs(ctx, n.Tags, &tags)

notification := radarr.NewNotificationResource()
Expand Down
3 changes: 1 addition & 2 deletions internal/provider/notification_kodi_resource.go
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,7 @@ func (n *NotificationKodi) write(ctx context.Context, notification *radarr.Notif
}

func (n *NotificationKodi) read(ctx context.Context) *radarr.NotificationResource {
var tags []*int32

tags := make([]*int32, len(n.Tags.Elements()))
tfsdk.ValueAs(ctx, n.Tags, &tags)

notification := radarr.NewNotificationResource()
Expand Down
Loading

0 comments on commit 4a20f86

Please sign in to comment.