Summary
The code generator produces types with a leading _ prefix and an Interface suffix:
type _QueryInterface[T any] interface { ... }
type _QueryImpl[T any] struct { ... }
Two issues:
_ prefix — In Go, _ is the blank identifier. Using it as a name prefix is non-standard and confuses readers into thinking the variable/type is discarded.
Interface suffix — Per Go convention, interfaces are named after the behavior they describe (e.g. io.Reader, not io.ReaderInterface).
Proposed
type Query[T any] interface { ... }
type QueryImpl[T any] struct { ... }
Since generated code is in the same package as the constructor func Query[T any](...), the unexported interface name queryIface or similar would also work if name clashes are a concern.
Root Cause
internal/gen/generator.go:611 — IfaceName: "_" + n.Name.Name
internal/gen/template.go — uses {{$IfaceName}}Interface and {{$IfaceName}}Impl
Affected
All generated output files. The template in internal/gen/template.go and the naming logic in internal/gen/generator.go need updating.
Summary
The code generator produces types with a leading
_prefix and anInterfacesuffix:Two issues:
_prefix — In Go,_is the blank identifier. Using it as a name prefix is non-standard and confuses readers into thinking the variable/type is discarded.Interfacesuffix — Per Go convention, interfaces are named after the behavior they describe (e.g.io.Reader, notio.ReaderInterface).Proposed
Since generated code is in the same package as the constructor
func Query[T any](...), the unexported interface namequeryIfaceor similar would also work if name clashes are a concern.Root Cause
internal/gen/generator.go:611—IfaceName: "_" + n.Name.Nameinternal/gen/template.go— uses{{$IfaceName}}Interfaceand{{$IfaceName}}ImplAffected
All generated output files. The template in
internal/gen/template.goand the naming logic ininternal/gen/generator.goneed updating.