Querypanic
var sqlquery="SELECT idfrom table where id=?"

func (mdao DbConn) Daoprocess(tz *entities.Workflowentity) ([]entities.WorkflowResponseEntity, error) {
    log.Println("In side dao")
    values := []entities.WorkflowResponseEntity{}
    rows, err := mdao.DB.Query(sqlquery, tz.Id)
    defer rows.Close()
    if err != nil {
       //code halts here. Nothing returns after here
       return values, err
    }
   for rows.Next() {
       value := entities.WorkflowResponseEntity{}
        err:=rows.Scan(&value.Id)
       if err != nil {
          log.Print("Daoprocess Scan Error", err)
           return values, err
       }
       values = append(values, value)
   }
   return values, nil
}

我的调用者函数是这样的

values, err1 := dataAccess.Daoprocess(tz)
log.Print("\n\n INSIDE MODEL")
log.Print(err1)
if err1 != nil {
    return t, false, err1, "Something Went Wrong"
}

错误是:

2021/03/17 15:41:14 http: panic serving [::1]:53440: runtime error: invalid memory address or nil pointer dereference
goroutine 6 [running]:
net/http.(*conn).serve.func1(0xc00010cb40)
    /usr/local/go/src/net/http/server.go:1801 +0x147
panic(0x8c7460, 0xc419e0)
    /usr/local/go/src/runtime/panic.go:975 +0x3e9
database/sql.(*Rows).close(0x0, 0x0, 0x0, 0x0, 0x0)
    /usr/local/go/src/database/sql/sql.go:3155 +0x76
database/sql.(*Rows).Close(0x0, 0x0, 0x0)
    /usr/local/go/src/database/sql/sql.go:3151 +0x33
panic(0x8c7460, 0xc419e0)
    /usr/local/go/src/runtime/panic.go:969 +0x175
database/sql.(*Rows).Next(0x0, 0xa095e0)
    /usr/local/go/src/database/sql/sql.go:2835 +0x30
iFIX/ifix/dao.DbConn.Checkprocessdelete(0xc000071d40, 0xc0001167e0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/subham/Documents/Projects/go/iFIX/ifix/dao/workflowdao.go:85 +0x227
iFIX/ifix/models.Checkprocessdelete(0xc0001167e0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0)
    /home/subham/Documents/Projects/go/iFIX/ifix/models/workflowmodel.go:350 +0x288
iFIX/ifix/handlers.Checkprocessdelete(0xa08c20, 0xc00017a0e0, 0xc00017e000)
    /home/subham/Documents/Projects/go/iFIX/ifix/handlers/workflowHandler.go:292 +0x237
net/http.HandlerFunc.ServeHTTP(0x9868d0, 0xa08c20, 0xc00017a0e0, 0xc00017e000)
    /usr/local/go/src/net/http/server.go:2042 +0x44
iFIX/ifix/router.PostMiddleware.func1(0xa08c20, 0xc00017a0e0, 0xc00017e000)
    /home/subham/Documents/Projects/go/iFIX/ifix/router/router.go:45 +0x659
net/http.HandlerFunc.ServeHTTP(0xc000178a00, 0xa08c20, 0xc00017a0e0, 0xc00017e000)
    /usr/local/go/src/net/http/server.go:2042 +0x44
net/http.(*ServeMux).ServeHTTP(0xc53460, 0xa08c20, 0xc00017a0e0, 0xc00017e000)
    /usr/local/go/src/net/http/server.go:2417 +0x1ad
net/http.serverHandler.ServeHTTP(0xc00017a000, 0xa08c20, 0xc00017a0e0, 0xc00017e000)
    /usr/local/go/src/net/http/server.go:2843 +0xa3
net/http.(*conn).serve(0xc00010cb40, 0xa095a0, 0xc000058300)
    /usr/local/go/src/net/http/server.go:1925 +0x8ad
created by net/http.(*Server).Serve
    /usr/local/go/src/net/http/server.go:2969 +0x36c

我想要处理错误并将其返回给caller.But,它创建一个panic.How来将它传递给调用者函数?