You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Seal file's four variants, discriminated by kind() #645
Any, Regular, Directory, SymbolicLink each become a sealed interface over an unexported struct (any, regular, directory, symbolicLink). Announcements keep naming provider.Regular and friends, so all four fragments stay byte-identical.
The discriminator (ruling 6)
Each variant interface declares kind() <Interface>:
Go compares full method signatures, result types included, so *regularcannot satisfy Directory. And because a type may declare only one method named kind, mutual exclusivity is structural — a concrete type cannot be two kinds at once. Four differently-named markers would keep the kinds distinct but say nothing about exclusivity; one name with four result types says both, and says it to the compiler.
Why this is not optional
Regular and Directory have identical exported method sets — verified 2026-08-24:
As bare interfaces they are structurally interchangeable: r.(Directory) would succeed for a regular file and every kind-honesty guarantee from #616 would evaporate without a single test failing.
And file is not merely an aesthetic exception. Its variants carry zero exported fields, so tryHydrateStruct fills nothing yet still forges and returns an identity-less *Regular. Part 1 alone leaves the most-used provider open on the very path that motivates the feature.
Watch here
op.RegisterResourceMint gains four interface→struct registrations. *Any's resolution at activation (op.KindResolver) and #616's supersession rules must be re-pinned against interface types rather than concrete ones — that is where a silent regression would hide.
Blocked on #650 before the transformation starts: the unexported struct for file.Any cannot be named any — that shadows the predeclared identifier for the whole package, including DiscoverAny(…, value any). Regular, Directory, and SymbolicLink lowercase cleanly; only this one needs a decision.
Activity
David-Noble-at-work commentedon Aug 24, 2026
Blocked on #650 before the transformation starts: the unexported struct for
file.Anycannot be namedany— that shadows the predeclared identifier for the whole package, includingDiscoverAny(…, value any).Regular,Directory, andSymbolicLinklowercase cleanly; only this one needs a decision.pkg's resource is sealed: an interface over an unexported struct, wit…
pkg's resource is sealed, and the five package manifests take the sch…
file's four variants are sealed interfaces discriminated by kind(), a…
file's four variants are sealed interfaces discriminated by kind(), a…
A value in an any slot carries its type, a resource slot records the …