- With issues:
- Use the search tool before opening a new issue.
- Please provide source code and commit sha if you found a bug.
- Review existing issues and provide feedback or react to them.
Description
How to reproduce
package main
import (
"github.com/gin-gonic/gin"
)
type CreatePlaybackRecordReq struct {
Data []DeviceRecordList `json:"data"`
}
func CreatePlaybackRecord(c *gin.Context) {
var req *CreatePlaybackRecordReq
if err := c.ShouldBindJSON(&req); err != nil {
c.Status(http.StatusBadRequest)
return
}
for _, deviceRecord := range req.Data {
.....
}
}
panic happend at line
for _, deviceRecord := range req.Data
Expectations
Environment
- go version: 1.17
- gin version (or commit ref): v1.6.3
- operating system:
Comment From: CCpro10
I think you should var req CreatePlaybackRecordReq, not var req *CreatePlaybackRecordReq