-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Open
Labels
type:with reproduction stepswith reproduction stepswith reproduction steps
Description
GORM Playground Link
I don't understand how to use the playground, but I added a self contained program that reproduces it.
Description
When building against 1.31.0, Preload for this testcase works, but when building against 1.31.1 it does not
Works correctly with gorm v1.31.0
Note User and Location are both non-nil as expected
bigbaby:gorm-preload-bug tadhunt$ grep gorm.io go.mod
gorm.io/gorm v1.31.0
bigbaby:gorm-preload-bug tadhunt$ make
go mod tidy
go vet
staticcheck
go build -o gorm-bug
bigbaby:gorm-preload-bug tadhunt$ ./gorm-bug
=== Loading shift with Preload ===
Shift ID: shift-001
Shift UserID: 1001
Shift LocationID: 2001
User: Alice Smith (ID: 1001)
Location: Office A (ID: 2001)
Fails with gorm v1.31.1
bigbaby:gorm-preload-bug tadhunt$ grep gorm.io go.mod
gorm.io/gorm v1.31.1
bigbaby:gorm-preload-bug tadhunt$ make
go mod tidy
go vet
staticcheck
go build -o gorm-bug
bigbaby:gorm-preload-bug tadhunt$ ./gorm-bug
=== Loading shift with Preload ===
Shift ID: shift-001
Shift UserID: 1001
Shift LocationID: 2001
ERROR: User is nil - Preload failed!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
type:with reproduction stepswith reproduction stepswith reproduction steps