Files
codeql/ql/test/experimental/InconsistentCode/GORMErrorNotCheckedGood.go
Sauyon Lee 1ffeb26a61 Add query for a GORM error not checked
co-authored-by: Sam Partington <sampart@github.com>
co-authored-by: Robin Neatherway <rneatherway@github.com>
2021-08-11 18:15:23 -07:00

12 lines
216 B
Go

package main
import "gorm.io/gorm"
func getUserIdGood(db *gorm.DB, name string) int64 {
var user User
if err := db.Where("name = ?", name).First(&user).Error; err != nil {
// handle errors
}
return user.Id
}