Corrected. The first version of this said nothing in the repository
generates with the flag on. That is wrong: entc/gen/graph_test.go builds a
graph with Features: AllFeatures, and #4 appended FeatureNoClientSchema to
that list, so TestGraph_Gen renders the flag-on templates on every
go test ./entc/gen/. The gap is narrower than stated and is below.
sql/no-client-schema (#4) drops Client.Schema and the <pkg>/migrate import
with it, so a binary that never migrates does not link Atlas.
What is covered
TestGraph_Gen runs graph.Gen() with every feature on, so the flag-on branch
of client.tmpl and enttest.tmpl is rendered, and Gen runs imports.Process
over the result (entc/gen/graph.go:1167). A template that fails to execute, or
that produces Go which does not parse, fails the test.
What is not
That test only os.Stats the files it expects. Nothing compiles them.
- A type error passes.
enttest.tmpl renders migrate.NewSchema(c.Driver())
under this flag; if Client.Driver() were renamed or its signature changed,
the file would render, parse and format, and every job would stay green.
- A stale import passes silently, because
imports.Process removes it rather
than reporting it.
The generate job compiles nothing extra either — every package in this
repository is generated with the flag off, which is what that job pins.
What would close it
A small integration package generated with the flag on, alongside the ones
generated without it: a schema, a generate.go carrying the feature, and a test
that creates the schema the way a caller must under this flag.
if err := migrate.NewSchema(drv).Create(ctx); err != nil {
...
}
Then both paths are compiled on every run and the generate job holds them both.
Also
entc/gen/template/migrate/migrate.tmpl:70 documents client.Schema.WriteTo in
a comment. Under this flag there is no client.Schema, so the example in the
generated package names something that package does not have.
sql/no-client-schema(#4) dropsClient.Schemaand the<pkg>/migrateimportwith it, so a binary that never migrates does not link Atlas.
What is covered
TestGraph_Genrunsgraph.Gen()with every feature on, so the flag-on branchof
client.tmplandenttest.tmplis rendered, andGenrunsimports.Processover the result (
entc/gen/graph.go:1167). A template that fails to execute, orthat produces Go which does not parse, fails the test.
What is not
That test only
os.Stats the files it expects. Nothing compiles them.enttest.tmplrendersmigrate.NewSchema(c.Driver())under this flag; if
Client.Driver()were renamed or its signature changed,the file would render, parse and format, and every job would stay green.
imports.Processremoves it ratherthan reporting it.
The
generatejob compiles nothing extra either — every package in thisrepository is generated with the flag off, which is what that job pins.
What would close it
A small integration package generated with the flag on, alongside the ones
generated without it: a schema, a
generate.gocarrying the feature, and a testthat creates the schema the way a caller must under this flag.
Then both paths are compiled on every run and the
generatejob holds them both.Also
entc/gen/template/migrate/migrate.tmpl:70documentsclient.Schema.WriteToina comment. Under this flag there is no
client.Schema, so the example in thegenerated package names something that package does not have.