Fix gosec's G601

This commit is contained in:
Deluan
2020-05-13 15:32:42 -04:00
parent 162971f7b3
commit 5ce3135f00
6 changed files with 22 additions and 11 deletions
+2 -1
View File
@@ -88,7 +88,8 @@ func (r *artistRepository) GetIndex() (model.ArtistIndexes, error) {
}
fullIdx := make(map[string]*model.ArtistIndex)
for _, a := range all {
for i := range all {
a := all[i]
ax := r.getIndexKey(&a)
idx, ok := fullIdx[ax]
if !ok {
+8 -4
View File
@@ -86,7 +86,8 @@ var _ = Describe("Initialize test DB", func() {
o := orm.NewOrm()
ctx := context.WithValue(log.NewContext(context.TODO()), "user", model.User{ID: "userid"})
mr := NewMediaFileRepository(ctx, o)
for _, s := range testSongs {
for i := range testSongs {
s := testSongs[i]
err := mr.Put(&s)
if err != nil {
panic(err)
@@ -94,7 +95,8 @@ var _ = Describe("Initialize test DB", func() {
}
alr := NewAlbumRepository(ctx, o).(*albumRepository)
for _, a := range testAlbums {
for i := range testAlbums {
a := testAlbums[i]
_, err := alr.put(a.ID, &a)
if err != nil {
panic(err)
@@ -102,7 +104,8 @@ var _ = Describe("Initialize test DB", func() {
}
arr := NewArtistRepository(ctx, o)
for _, a := range testArtists {
for i := range testArtists {
a := testArtists[i]
err := arr.Put(&a)
if err != nil {
panic(err)
@@ -110,7 +113,8 @@ var _ = Describe("Initialize test DB", func() {
}
pr := NewPlaylistRepository(ctx, o)
for _, pls := range testPlaylists {
for i := range testPlaylists {
pls := testPlaylists[i]
err := pr.Put(&pls)
if err != nil {
panic(err)
+2 -1
View File
@@ -74,7 +74,8 @@ func (r *playlistRepository) GetAll(options ...model.QueryOptions) (model.Playli
func (r *playlistRepository) toModels(all []playlist) model.Playlists {
result := make(model.Playlists, len(all))
for i, p := range all {
for i := range all {
p := all[i]
result[i] = r.toModel(&p)
}
return result