title: Golang cannot range over pointer to slice
body: <p>I keep getting this error when trying to range over a slice pointer.</p>
  
  <pre><code>app/domain/repositories/class_repository.go:24: cannot range over classes (type *[]entities.Class)
  </code></pre>
  
  <p>What am I doing wrong?</p>
  
  <p>Here is the struct:</p>
  
  <pre><code> package repositories
  
  import (
      "mobifit/app/domain/entities"
  )
  
  type ClassRepository struct {
      *Repository
  }
  
  func (c *ClassRepository) ClassesForLastNDays(days int) *[]entities.Class {
      classes := new([]entities.Class)
      query := Select("*").
          From("Class").
          Where("VisibleAt &gt; CURRENT_TIMESTAMP() - INTERVAL ? DAY").
          OrderBy("ClassTypeId").
          Sql()
      c.Repository.Select(classes, query, days)
      c.populateClassRelationships(classes)
      return classes
  }
  
  func (c *ClassRepository) populateClassRelationships(classes *[]entities.Class) {
      for i := range classes {  &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt; Here is the problem
          class := classes[i]
  
          // ClassType
          c.Repository.GetById(class.ClassType, class.ClassTypeId)
  
          //Instructor
          c.Repository.GetById(class.Instructor, class.ClassType.InstructorId)
  
          // Equipment
          query := Select("E.*").
              From("Equipment E").
              Join("ClassEquipment CE on E.Id = CE.EquipmentId").
              Where("CE.ClassId = ?").
              Sql()
          c.Repository.Select(class.Equipment, query, class.Id)
      }
  }
  </code></pre>
  
  <p>Here is the Class struct:</p>
  
  <pre><code>package entities
  
  import (
      "time"
  )
  
      type Class struct {
          Id                int
          ClassTypeId       int
          VideoPath         string
          VideoSize         int
          Duration          float64
          CreatedAt         time.Time
          VisibleAt         time.Time
          NoLongerVisibleAt time.Time
  
          // Relationships
          ClassType  ClassType
          Instructor User
          Equipment  []Equipment
      }
  </code></pre>