Documentation
¶
Overview ¶
Package facadegen writes a facade package: one that re-exports another package's whole exported API under a new import path, so github.com/weftgo/weft (the framework) offers the loop that github.com/weftgo/weft/core (the slim module) implements, under the same names. Types become aliases, constants and variables become re-declarations bound to the originals, and functions become one-line wrappers — a wrapper rather than a func variable so the signature, its generics and its doc comment survive on pkg.go.dev.
The facade is generated from source (go/ast), never hand-written: a release regenerates it (go generate ./...) and TestFacadesAreComplete fails the build when the facade and its source disagree.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Options ¶
type Options struct {
// SrcDir is the directory of the package being re-exported.
SrcDir string
// SrcImport is its import path; SrcName the local name the facade
// imports it under (shown on pkg.go.dev as the alias target).
SrcImport, SrcName string
// DstPkg is the facade's package name.
DstPkg string
// Rewrite maps an import path the source's signatures use to the
// path the facade should name instead — the layers' facades name
// github.com/weftgo/weft where the source names its core, so the
// documented signatures read weft.Model, not core.Model. The local
// name is the rewritten path's last element.
Rewrite map[string]string
// Generate is the go:generate line to record, verbatim, without
// the "//go:generate " prefix.
Generate string
}
Options describe one facade.