alexedwards / scs

HTTP Session Management for Go
MIT License
2.05k stars 165 forks source link

Prevent gorm from logging a warning when record is not found. #142

Closed manon-gfx closed 9 months ago

manon-gfx commented 2 years ago

When using the First function, gorm will log that it failed to find a record. Since this case is valid in scs it makes no sense to log it. By using different syntax the same functionality is achieved but without the logging.

alexedwards commented 1 year ago

@manon-gfx I'm afraid that this change breaks the tests TestFindMissing and TestExpiry. I don't use gorm myself, and haven't researched it, but I suspect that the reason is that Find() doesn't return a gorm.ErrRecordNotFound error if no matching record exists.

alexedwards commented 9 months ago

I've fixed this issue in master in a way that avoids breaking the tests.