错误: ent/atlas 中的并发迁移数据竞争
作者: lrstanley创建于 2026年9月12日更新于 2026年9月12日
Example of some of these races
go test -race ./internal/...
==================
WARNING: DATA RACE
Write at 0x00000394aa38 by goroutine 27:
entgo.io/ent/dialect/sql/schema.(*Atlas).setupTables()
/home/liam/go/pkg/mod/entgo.io/[email protected]/dialect/sql/schema/atlas.go:1100 +0x7ef
entgo.io/ent/dialect/sql/schema.(*Atlas).Create()
/home/liam/go/pkg/mod/entgo.io/[email protected]/dialect/sql/schema/atlas.go:107 +0x70
GitHub.com/lrstanley/moroi/internal/database/ent/migrate.Create()
/home/liam/go/src/GitHub.com/lrstanley/moroi/internal/database/ent/migrate/migrate.go:58 +0x1b2
GitHub.com/lrstanley/moroi/internal/database/ent/migrate.(*Schema).Create()
/home/liam/go/src/GitHub.com/lrstanley/moroi/internal/database/ent/migrate/migrate.go:49 +0x91
GitHub.com/lrstanley/moroi/internal/database.Migrate()
/home/liam/go/src/GitHub.com/lrstanley/moroi/internal/database/client.go:94 +0x195
GitHub.com/lrstanley/moroi/internal/database/schematests.NewClient()
/home/liam/go/src/GitHub.com/lrstanley/moroi/internal/database/schematests/core.go:46 +0x144
GitHub.com/lrstanley/moroi/internal/auth_test.TestLookupRevokedAPIKey()
/home/liam/go/src/GitHub.com/lrstanley/moroi/internal/auth/apikey_test.go:131 +0x4f
testing.tRunner()
/usr/local/go/src/testing/testing.go:2193 +0x21c
testing.(*T).Run.gowrap1()
/usr/local/go/src/testing/testing.go:2258 +0x38
Previous read at 0x00000394aa38 by goroutine 24:
entgo.io/ent/dialect/sql/schema.(*Atlas).realm()
/home/liam/go/pkg/mod/entgo.io/[email protected]/dialect/sql/schema/atlas.go:908 +0x1512
…内容来源: ent/ent