转到语言增量编号

I can't make increment number of rows on my table..
I used revel framework, and try make simple crud.

The question is: "How to show increment number with Golang.?".

This my code of controller book.go
This controller to show data from postgresql database.

func allBooks() ([]models.Book, error) {
    //Retrieve
    books := []models.Book{}

    rows, err := db.Query("SELECT id, name, author, pages, publication_date FROM books order by id")
    defer rows.Close()
    if err == nil {
        for rows.Next() {
            var id int
            var name string
            var author string
            var pages int
            var publicationDate pq.NullTime

            err = rows.Scan(&id, &name, &author, &pages, &publicationDate)
            if err == nil {
                currentBook := models.Book{ID: id, Name: name, Author: author, Pages: pages}
                if publicationDate.Valid {
                    currentBook.PublicationDate = publicationDate.Time
                }

                books = append(books, currentBook)
            } else {
                return books, err
            }

        }
    } else {
        return books, err
    }
    return books, err
}  

And this html on my views index.html:

<table class="table table-striped">
  <thead>
    <tr>
      <th>No</th>
      <th>ID</th>
      <th>Name</th>
      <th>Author</th>
      <th>Pages</th>
      <th>Publication Date</th>
      <th>Action</th>
    </tr>
  </thead>
  <tbody>

    {{range .books}}
    <tr>
      <td>{{.Nomor}}</td>
      <td>{{.ID}}</td>
      <td>{{.Name}}</td>
      <td>{{.Author}}</td>
      <td>{{.Pages}}</td>
      <td>{{.PublicationDateStr}}</td>
    </tr>
    {{end}}
    <tr>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td></td>
      <td><a href="book.html" class="btn btn-primary">New book</a></td>
    </tr>
  </tbody>
</table>  

hope result like this

|No.|ID |Name |Author | Pages | Publication Date  |
|1  |2  |Jack |Holly  | 255   | 2017-10-15        |
|2  |4  |hans |Holly  | 255   | 2017-10-15        |
|3  |6  |Juri |Holly  | 255   | 2017-10-15        |
|4  |7  |Hank |Holly  | 255   | 2017-10-15        |

but what I get is

|No.|ID |Name |Author | Pages | Publication Date | 
|0  |2  |Jack |Holly  | 255   | 2017-10-15       | 
|0  |4  |hans |Holly  | 255   | 2017-10-15       | 
|0  |6  |Juri |Holly  | 255   | 2017-10-15       | 
|0  |7  |Hank |Holly  | 255   | 2017-10-15       |

I do not see the property Nomor populated anywhere.

You should keep a counter and do something like

...
currentBook := models.Book{Nomor: count, ID: id, Name: name, Author: author, Pages: pages}
count = count + 1
...

You could try assinging the values of slice index to a variable and try printing it, something like

{{range $index, _ := .books}}

and use the index instead of Nomor