v4.0.0
Fries v4.0.0
v4.0.0 is the first stable release of Fries v4.
Fries v4 moves the repository to /v4 module paths, upgrades Kratos integrations to Kratos v3, adopts the standard library log/slog model, and stabilizes the context-aware component APIs introduced throughout the v4 prerelease cycle.
Compared with v4.0.0-beta.3, this release adds standalone Health and JSON Response components, extracts pointer helpers into ptr/v4, consolidates root examples into component documentation, and refreshes dependencies across the multi-module repository.
Important
Applications upgrading from v4.0.0-beta.3 must migrate support.Ptr and support.Val to ptr/v4. Applications upgrading from Fries v3 or an earlier v4 prerelease should also review the major v4 migration checklist below.
Upgrade
Fries is a multi-module repository. Upgrade the root module and every component module used by the application to the same stable version.
go get github.com/go-fries/fries/v4@v4.0.0
go get github.com/go-fries/fries/health/v4@v4.0.0
go get github.com/go-fries/fries/http/response/v4@v4.0.0
go get github.com/go-fries/fries/ptr/v4@v4.0.0
go mod tidy
go test ./...Replace the example component modules with those imported by the application. Modules that depend on other Fries modules should use the same Fries release.
Highlights
- Establish the stable Fries v4 module set with
/v4import paths, Kratos v3 integrations, and standard-librarylog/slogsupport. - Use context-aware Lifecycle, Retry, Poll, Parallel, Locker, and Event components with explicit cancellation, ownership, concurrency, and error behavior.
- Add named application health checks with bounded concurrency, structured reports, panic recovery, and standard liveness and readiness HTTP handlers.
- Add framework-neutral JSON response envelopes with explicit HTTP status handling, safe serialization, and application-defined error mapping.
- Move pointer construction and optional pointer access into the focused
ptr/v4module. - Keep usage guidance close to component APIs through README documentation and package-local compile-checked examples.
Changes since v4.0.0-beta.3
Health checks
#2654 adds github.com/go-fries/fries/health/v4 for named, context-aware application health checks.
A registry runs a stable snapshot of checks with a shared timeout and bounded concurrency. Results remain in registration order, ordinary failures do not stop other checks, and checker panics are returned as structured PanicError results instead of terminating the process.
Use separate registries for liveness and readiness:
readiness := health.New(
health.WithTimeout(2*time.Second),
health.WithConcurrency(4),
)
readiness.Register("database", health.CheckFunc(db.PingContext))
liveness := health.New()
mux.Handle("/readyz", health.Handler(readiness))
mux.Handle("/livez", health.Handler(liveness))The HTTP handler supports GET and HEAD, returns 200 OK for healthy reports and 503 Service Unavailable for unhealthy reports, and hides raw checker errors by default.
Note
Enable health.WithErrorDetails() only for protected internal endpoints when exposing raw dependency errors is acceptable.
JSON responses
#2658 adds github.com/go-fries/fries/http/response/v4 for consistent JSON response envelopes without coupling callers to a web framework.
body := response.Success(
"Scratch 11 is working properly.",
scratch,
response.WithCode(10000),
)
if err := response.Write(w, http.StatusOK, body); err != nil {
return err
}The real HTTP status remains explicit and independent from the application-defined code. Success, Failure, and FromError construct response bodies, while ErrorMapper and ErrorMapperFunc centralize conversion from domain errors to HTTP status, business code, and public message.
response.Write serializes the complete body before committing HTTP headers, so JSON encoding failures remain observable.
Warning
Use FromError only when the error text is safe to expose. Map internal and unknown errors to a public fallback message.
Pointer helpers
#2656 removes support.Ptr and support.Val and introduces the focused github.com/go-fries/fries/ptr/v4 module.
Pointer API mapping
| Before | After |
|---|---|
support.Ptr(value) |
ptr.Ptr(value) |
support.Val(pointer) |
ptr.Value(pointer) or ptr.Or(pointer, fallback) |
Before:
value := support.Ptr("fries")
result := support.Val(value)After:
value := ptr.Ptr("fries")
result, present := ptr.Value(value)
fallbackResult := ptr.Or(value, "default")Migration requirements:
- Add
github.com/go-fries/fries/ptr/v4to the consuming module. - Replace
support.Ptr(value)withptr.Ptr(value). - Replace
support.Val(pointer)withptr.Value(pointer)when the nil state must be observed. - Use
ptr.Or(pointer, fallback)when a fallback value is required. - Remove the
support/v4dependency when no other Support API is used.
ptr.Value(nil) returns the type's zero value and false. A non-nil pointer to a zero value returns that value and true. ptr.Or uses its fallback only when the pointer itself is nil.
Component documentation and examples
#2688 removes the repository-level examples/ directory and keeps usage guidance beside the components it documents.
| Removed example module | Replacement |
|---|---|
github.com/go-fries/fries/examples/cache/v4 |
cache/README.md |
github.com/go-fries/fries/examples/cloudevents/amqp091/v4 |
cloudevents/protocol/amqp091/README.md |
github.com/go-fries/fries/examples/cloudevents/eventdispatcher/v4 |
cloudevents/eventdispatcher/README.md and example_test.go |
github.com/go-fries/fries/examples/mysql/canal/v4 |
mysql/canal/README.md |
These modules were excluded from releases and exposed only executable package main programs. No releasable library component was removed. Nested component examples such as queue/examples/tasker and eino/components/embedding/cached/example remain available.
Major v4 migration checklist
Applications upgrading directly from Fries v3 should review the following changes:
- Replace Fries imports from
/v3with/v4. - Upgrade
github.com/go-kratos/kratos/v2imports and dependencies to Kratos v3. - Replace
contract/v4withcapability/v4. - Replace legacy
kratos/log/*components withlog/slog/*or the official OpenTelemetryotelslogbridge, and pass*slog.Loggerto component logger options. - Replace the old Filesystem API with the streaming
filesystem.Drivercontract and optional capability interfaces. - Replace
coroutines/v4with the context-awareparallel/v4APIs. - Replace the Hashing global registry with reusable hash constructors and typed digests.
- Construct built-in codecs as zero-value concrete types such as
json.Codec{}. - Replace
support.Retrywithretry/v4, and replace legacy polling and timeout helpers withpoll/v4and standard Go Context deadlines. - Replace
foundation/v4withlifecycle/v4. - Migrate Locker to the reusable
Locker -> Lock -> Leaseownership model. - Replace
eventbus/v4with the synchronous, type-awareevent/v4Dispatcher. - Replace
support.Ptrandsupport.Valwithptr/v4.
Detailed API mappings, before-and-after examples, and behavioral notes are available in the prerelease documentation:
- v4.0.0-beta.1:
/v4module paths, Kratos v3,log/slog, Capability, and OpenTelemetry alignment. - v4.0.0-beta.2: Filesystem, Parallel, Hashing, Codec, Retry, Poll, Hyperf Jet Retry, Support, and Queue.
- v4.0.0-beta.3: Lifecycle, Locker, Event, and removal of legacy Support polling and timeout helpers.
What's changed
Breaking API changes
- #2656
refactor(support)!: extract pointer helpers
Features
Documentation and repository structure
- #2688
refactor: consolidate examples with component documentation
Dependencies
- #2651
fix(deps): update module github.com/aws/aws-sdk-go-v2/service/s3 to v1.105.2 - #2650
fix(deps): update module github.com/aliyun/alibabacloud-oss-go-sdk-v2 to v1.5.3 - #2649
chore(deps): update module github.com/dlclark/regexp2/v2 to v2.5.1 - #2653
fix(deps): update golang.org/x to 764159d - #2655
chore(deps): update module github.com/dlclark/regexp2/v2 to v2.5.2 - #2660
chore(deps): update module github.com/klauspost/compress to v1.19.1 - #2659
chore(deps): update github.com/charmbracelet/ultraviolet digest to 7cc6674 - #2670
chore(deps): update module github.com/prometheus/common to v0.70.1 - #2669
fix(deps): update module github.com/cloudwego/eino to v0.9.13 - #2667
fix(deps): update module github.com/rabbitmq/amqp091-go to v1.13.0 - #2666
chore(deps): update module github.com/prometheus/client_golang to v1.24.0 - #2665
chore(deps): update module github.com/nunnatsa/ginkgolinter to v0.23.1 - #2664
chore(deps): update module github.com/go-logr/logr to v1.4.4 - #2668
fix(deps): update aws-sdk-go-v2 monorepo - #2662
chore(deps): update googleapis to 0afa2a6 - #2663
chore(deps): update module github.com/ebitengine/purego to v0.10.2 - #2674
chore(deps): update module github.com/leodido/go-urn to v1.5.0 - #2672
chore(deps): update module buf.build/gen/go/bufbuild/bufplugin/protocolbuffers/go to v1.36.11-20260722160903-4d94f3df3a7b.1 - #2671
chore(deps): update module github.com/gabriel-vasile/mimetype to v1.4.14 - #2679
chore(deps): update module github.com/mattn/go-isatty to v0.0.24 - #2678
chore(deps): update module github.com/gabriel-vasile/mimetype to v1.4.15 - #2675
chore(deps): update github.com/timakin/bodyclose digest to 857993a - #2677
chore(deps): update googleapis to 3fe39f3 - #2682
chore(deps): update module github.com/go-git/go-billy/v5 to v5.9.1 - #2681
chore(deps): update github.com/petermattis/goid digest to f64c70f - #2680
chore(deps): update module github.com/mattn/go-runewidth to v0.0.27 - #2683
chore(deps): update module github.com/prometheus/client_golang to v1.24.1 - #2673
chore(deps): update module go.opentelemetry.io/proto/otlp to v1.11.0 - #2687
chore(deps): update module github.com/docker/go-connections to v0.8.0 - #2686
chore(deps): update github.com/petermattis/goid digest to 500c67a - #2685
chore(deps): update module github.com/quic-go/quic-go to v0.61.0 - #2684
chore(deps): update googleapis to b2f2020 - #2690
chore(deps): update module go.yaml.in/yaml/v3 to v3.0.5 - #2689
chore(deps): update module github.com/google/cel-go to v0.30.0
Release
- #2691
Release v4.0.0
Full Changelog: v4.0.0-beta.3...v4.0.0