Repository navigation
Releases: donseba/go-partial
Release list
v0.14.0
v0.13.0
v0.12.0
v0.11.0
v0.10.0
v0.9.0
Headline changes
Partialis now reusable tree/configuration data. Rendering is done through
package functions:partial.Render,partial.RenderWithRequest, and
partial.Write.ServiceandLayouthave been removed. A root partial now acts as the
page shell/blueprint and can be cloned per request.- Render extension points are now called render stages:
partial.RenderStage,partial.RenderStageHooks, andPartial.Use. - Request-scoped render state has been moved out of
Partialand into
RenderContext, fixing data bleed risks during concurrent renders. - New experimental and extension packages provide focused helpers for HTMX/SSR
applications: flash messages, interactions, selection, actions, target
resolution, SSE, slots, page flow, localization, CSRF, metrics, OpenTelemetry,
debug rendering, error rendering, and logging. - Documentation and showcase have been rebuilt around the new root blueprint
model.
Breaking changes
Service and Layout were removed
The old partial.NewService(&partial.Config{...}), Service.NewLayout,
Layout.Set, Layout.Wrap, Layout.RenderWithRequest, and
Layout.WriteWithRequest APIs are gone.
Use a configured root partial instead:
root := partial.NewID("shell", "templates/shell.gohtml").
SetFileSystem(os.DirFS("web")).
SetConnector(connector.NewHTMX(nil)).
Use(exterrors.Stage())
func handler(w http.ResponseWriter, r *http.Request) {
content := partial.NewID("content", "templates/home.gohtml").
SetDot(HomePage{})
page := root.Clone().SetContent(content)
if err := partial.Write(r.Context(), w, r, page); err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
}
}Partial render methods were removed
The old methods:
p.Render(ctx)
p.RenderWithRequest(ctx, r)
p.WriteWithRequest(ctx, w, r)are replaced by:
partial.Render(ctx, p)
partial.RenderWithRequest(ctx, r, p)
partial.Write(ctx, w, r, p)partial.Write owns HTTP response behavior: configured headers, connector
response headers, stage response metadata, error fragments, and out-of-band
regions.
Renderer terminology was replaced by render stages
The old renderer hook vocabulary has been replaced with stages:
root.Use(partial.RenderStageHooks{
PrepareFunc: func(ctx *partial.RenderContext) (*partial.RenderContext, error) {
return ctx, nil
},
})Extension packages now expose Stage(...) constructors, for example
metrics.Stage(...), flash.Stage(...), exterrors.Stage(...), and
interactions.Stage(...).
Built-in helper surface is smaller
Core only protects and injects helpers that it needs for rendering:
ctx, request, url, runtime, partial, content, OOB helpers, and
connector state helpers.
Generic helpers such as dict, string helpers, date helpers, collection
helpers, and counters now live in:
github.com/donseba/go-partial/exp/templatehelpers
Register them explicitly:
root.SetFunc(templatehelpers.FuncMap())Interaction helpers moved to exp/interactions
Core no longer auto-registers async, poll, reveal, on, stream,
prefetch, or refresh.
Use:
root.SetFunc(interactions.FuncMap())
root.Use(interactions.Stage())The helpers support both endpoint-string usage and typed
interactions.Interaction values registered with SetContract("interaction", ...).
Old JavaScript assets and legacy examples were removed
The old js/ package and older standalone examples were removed. The showcase
and docs apps are now the canonical examples.
Connector cleanup
Unused legacy connector shims were removed. The maintained connector focus is
now HTMX, Turbo, Unpoly, and the generic partial connector.
New core capabilities
Request-safe render context
RenderContext carries request-scoped data, functions, events, response
metadata, selected target information, and stage values. Reusable partial trees
do not store request data during rendering.
This is covered by new concurrency tests for:
- partial renders
- cloned root/shell renders
- cached template renders
- stage values
- target rendering
- OOB rendering
- connector reads
- request context fallback
Root blueprint rendering
A configured root partial can be reused as a blueprint:
root := partial.New("templates/shell.gohtml").Use(allStages...)
page := root.Clone().
SetContent(partial.NewID("content", "templates/blog.gohtml"))Clone copies the partial tree configuration so request-specific content,
dot data, and response state can be attached without mutating the shared
blueprint.
Connector response builder
Connector response behavior is now configurable through Partial.Response()
and SetResponse, including retargeting, reswapping, triggers, redirects,
refreshes, and URL updates. partial.Write applies those headers.
Diagnostic events
The new event system emits render lifecycle, template, content, target,
contract, OOB, and write diagnostics.
Useful entry points:
events := partial.NewAsyncEvents(partial.EventsConfig{Buffer: 256}, sink)
root.SetEvents(events)
ctx := partial.WithEventSink(r.Context(), requestSink)New packages
exp/flash
Experimental flash message helpers for SSR and HTMX responses.
Features:
- default embedded message and target templates
- overrideable message and target partials
- levels: success, info, warn, error, and custom levels
- request-scoped stores
- OOB-friendly
flashTargetandflashhelpers - concurrency coverage
exp/interactions
Typed and endpoint-based helpers for HTMX-style interactions:
- async/deferred regions
- reveal
- poll
- stream
- prefetch
- refresh
- event-triggered interactions
- go-doc metadata for helper signatures
exp/templatehelpers
Optional generic template helpers for strings, URLs, safe HTML, time,
collections, numbers, and dictionaries.
exp/target
Dynamic target resolution for requests where the target ID maps to data-backed
partials, such as row updates.
exp/selection and exp/actions
Selection and action helpers were split into focused packages instead of being
part of core rendering.
exp/slots
Named slots for composing child partials through template helpers.
exp/sse
Server-Sent Events writer helpers that can render partials through the same
stage chain as normal responses.
exp/localization and exp/csrf
Request-context based localization and CSRF helper packages.
exp/metrics and exp/otel
Passive render metrics and OpenTelemetry event sinks.
ext/errors, ext/debug, ext/logger
Optional non-experimental extensions for error output, debug rendering, and
structured logging.
Documentation and showcase
The docs and showcase have been rebuilt around the current API:
- root blueprint setup
- request context guidance
- render stages
- error boundaries
- diagnostic events
- observability
- template helper providers
- flash messages
- interactions/deferred rendering
- target resolution
- selection/action helpers
- SSE
- page flow
- localization
- connectors
The old small examples were removed in favor of the new showcase and docs apps.
go-doc support
The repository now includes .go-doc/config.json and typed contract metadata
for template helper discovery.
Important APIs:
SetModel(values...)
SetContract(annotation, values...)
SetDot(value)
SetFunc(funcMaps...)NamedContract lets values choose a stable contract name.
Tooling and CI
- The module now targets the Go version declared in
go.mod. - The golangci-lint workflow now uses Node 24-compatible actions:
actions/checkout@v5,actions/setup-go@v6, and
golangci/golangci-lint-action@v9. - Tailwind-based CSS builds were added for docs and showcase.
- New tests cover rendering, events, stages, template caching, connectors,
experimental packages, and concurrency-sensitive paths.
Migration checklist from v0.8.0
- Replace
NewServiceandLayoutusage with a reusable root partial. - Replace
p.Render,p.RenderWithRequest, andp.WriteWithRequestwith
partial.Render,partial.RenderWithRequest, andpartial.Write. - Replace renderer hook terminology with
RenderStageandRenderStageHooks. - Move generic helpers to
exp/templatehelpersand register them explicitly. - Move async/poll/reveal/on/stream/prefetch/refresh helpers to
exp/interactions. - Add
exterrors.Stage()fromgithub.com/donseba/go-partial/ext/errors
where you want rendered failure responses frompartial.Write. - Clone reusable root partials before attaching request-specific content or
dot data. - Pass
r.Context()or a derived request context into rendering and writing. - Use
SetEventsorWithEventSinkfor diagnostics instead of render-time
state onPartial.
Release intent
v0.9.0 intentionally breaks parts of v0.8.0 so the project can enter the
v1.0 feedback period with a cleaner core API. The core is now smaller and more
explicit, while SSR/HTMX-oriented behavior lives in focused exp and ext
packages that can mature with real application feedback.


