Documentation
¶
Overview ¶
Package boundary checks that the production core links none of the reflection-driven standard-library packages TinyGo cannot build faithfully (go list -deps over the core packages, the Go and the Wasm configuration).
Index ¶
Constants ¶
const WasmMain = "cmd/corewasm"
WasmMain is the reactor's main package (the one TinyGo builds); it is a root of the wasip1 closure only.
Variables ¶
var CorePackages = []string{"abi", "jv", "internal/delta", "rec", "history", "store", "session/hopcost", "session", "docs", "inbox", "turn", "."}
CorePackages are the packages built into the Wasm module (ADR D15, LAYOUT.md), as import paths relative to durable/core.
var ForbiddenPackages = []string{
"encoding/json", "encoding/json/v2", "encoding/json/jsontext", "reflect", "text/template", "text/template/parse", "html/template",
}
ForbiddenPackages are the packages the core must not link: each is reflection or reflection-driven (TinyGo supports them only partially, and they pull large runtime support into the Wasm module), so a core package that reached one would build under Go and break or bloat under TinyGo.
var NonCorePackages = []string{
"abi/abitest", "abi/payload", "abi/spec", "abi/spec/cmd/abigen", "budget/coldhints", "budget/tinygo/patchdata", "cmd/corenative", "contracttest", "contracttest/binding", "contracttest/boundary",
"contracttest/cmd/benchhost", "contracttest/cmd/countgate", "contracttest/cmd/replayhost", "contracttest/cmd/scprovider", "contracttest/counts",
"contracttest/fuel", "contracttest/guard", "contracttest/storehost", "driver",
"history/internal/buildcheck", "probe", "session/cmd/tgprobe", "session/sessiontest", "sqlhost", "sqlhost/cmd/bench",
}
NonCorePackages are the durable/core packages that are not built into the Wasm module: hosts, drivers, tooling and the test-only helpers. They may use the whole standard library.
var StdRoutes = map[string][]string{"encoding/binary": {"reflect"}}
StdRoutes are the standard-library edges to a forbidden package the core accepts: encoding/binary imports reflect for Read and Write on arbitrary values, and the core calls only the byte-order and Append functions, which the linker keeps without reflect's support. Every other standard-library route (fmt, encoding/gob, sort on Go versions that used reflect...) is a violation.
Functions ¶
This section is empty.
Types ¶
type Graph ¶
Graph maps an import path to the packages it imports (non-test files of one build configuration).
type Violation ¶
Violation is one forbidden dependency and the import chain that reaches it.
func CheckGraph ¶
CheckGraph returns a violation for every root that reaches a forbidden package, by the shortest chain. A standard-library package (an import path without a dot in its first element) may import a forbidden package only along a StdRoutes edge; that edge is not followed, so the route is neither reported nor counted as the root reaching the package.
func CheckImportBoundary ¶
CheckImportBoundary lists the patterns' dependency closure and returns its violations of ForbiddenPackages.