v1.141.0
v1.141.0
This release makes gogen fully pure-Go, removes the go.uber.org/multierr dependency, and applies a consistent hardening pass across the HTTP-client, messaging, and country-data packages: exported sentinel errors matchable with errors.Is, construction-time validation instead of deferred or panicking failures, bounded/secret-safe response handling, and client injection for dependency-free unit tests.
⚠️ This is a breaking release. Every package below marked with!changes behavior, option names, or error types. See Breaking changes for migration notes.
Highlights
- gogen is now 100% pure-Go. The only CGO dependency,
pkg/kafkacgo(Confluent/librdkafka), has been removed — cross-compilation, scratch/distroless images, and CGO-free builds now work out of the box. go.uber.org/multierrdependency dropped.kafka,validator, anderrutilnow use the standard library'serrors.Join, so the module no longer depends on multierr.- Uniform error taxonomy. HTTP clients (
devlake,jirasrv,slack,sleuth,ipify) and messaging clients (kafka,redis,valkey) now export sentinel errors wrapped with%w, so callers can distinguish configuration problems from response/runtime failures viaerrors.Is. - Fail fast at construction. Retry/option validation moved from the first request/send into
New/NewProducer/NewConsumer. - Safer responses. Response bodies are drained and capped with
io.LimitReaderfor connection reuse, non-2xx snippets (secret-redacted) are appended to errors, and nil-request/nil-body guards replace latent panics.
Breaking changes
pkg/kafkacgoremoved. Migrate togithub.com/tecnickcom/gogen/pkg/kafka(context-native, no CGO); note the option/error surface differs (segmentio/kafka-go rather than librdkafka).kafka:NewProducer/NewConsumervalidate at construction and return errors matchingErrInvalidOptions/ErrNilEncodeFunc/ErrNilDecodeFunc;NewProducer'surlsparameter renamed tobrokers;Receive/FetchMessage/ReceiveDatareturnErrConsumerClosedafterClose(no longer wrapio.EOF).redis:Get/GetDatareturnErrKeyNotFound(no longer matchesredis.Nil);WithSubscrChannels→WithChannels,WithSubscrChannelOptions→WithChannelOptions; empty channel names andAddr/Networkmismatches rejected at construction.valkey: subscription lifetime is bound toCloserather than theNewcontext (Closeis now mandatory when channels are configured);Get/GetDatareturnErrKeyNotFound(no longer matchesvalkeygo.Nil/IsValkeyNil); empty channel names rejected.ipify: a 200 with an empty body now returnsErrInvalidResponse, non-http/httpsURLs are rejected at construction, and the response body is capped at 64 bytes.devlake/jirasrv/sleuth:Newvalidates retry options (ErrInvalidRetryConfig) at construction; retries now honor a server-providedRetry-After(capped at 60s); error message texts changed.slack:HealthChecknow fails during an active Apps/Integrations/APIs incident (previously it could never fail); default ping URL changed tohttps://slack-status.com; retry validation moved to construction.countryphone:NumInfo.Geochanges from[]*GeoInfoto[]GeoInfo; removed the unusedPrefixDataalias; dropped non-ISO codesCT(+90) andQN(+374) so+90→TRand+374→AMonly.countrycode: internal length/character/parse errors now wrap the exportedErrInvalidCode/ErrNotFound.validator: the aggregate error fromValidateStruct/ValidateStructCtxnow renders with newline separators (errors.Join) instead of multierr's"; ". The error type,errors.Is/errors.Astraversal, and one-*Error-per-failed-tag structure are unchanged; only the concatenatedError()string differs.
Changes by package
kafka
- Sentinel errors
ErrInvalidOptions,ErrNilEncodeFunc,ErrNilDecodeFunc,ErrConsumerClosed. WithKafkaReader/WithKafkaWriterinject an existing kafka-go reader/writer (via newKReader/KWriterinterfaces) for dependency-free tests.- Add
Producer.HealthCheckandWithBrokerCheckFunc(custom per-broker probe). - Replace
go.uber.org/multierrwith stdliberrors.Join; probe every broker and join errors only when all fail; clone the caller's broker slice at construction.
redis
- Sentinel errors incl.
ErrKeyNotFound,ErrNoSubscription,ErrSubscriptionClosed,ErrInvalidChannelName. - Unix domain socket support;
WithRedisClientinjection; idempotentClose. - Extensive doc and test rework (key-not-found, double
Close, concurrentClose, nil-message skipping, unix socket validation); coverage stays 100%.
valkey
- Sentinel errors mirroring
redis; deterministic clean-closure reporting via an atomic closed flag; idempotentCloseviasync.Once. - Skip
InitAddressvalidation when a client is injected viaWithValkeyClient.
ipify
- Export
ErrInvalidOptions/ErrInvalidResponse; URL validation at construction; nil-body guard; addClient.HealthCheck.
devlake / jirasrv / sleuth
- Sentinel errors, single prebuilt retrier (method-aware read/write retriers in
jirasrv),Retry-Aftersupport, bounded response drains, nil-request guards, and secret-safe error snippets.
slack
- Real status-incident health check against the live Slack status API v2.0.0, sentinel errors,
WithRetryDelay, and secret-safe address validation.
countryphone
- Value-slice
GeoInfo, sentinel errors (ErrNoMatch,ErrInvalidNumberType,ErrInvalidAreaType), nil-entry and empty-prefix guards, hoisted lookup tables, benchmarks, and runnable examples.
countrycode
- Exported
ErrInvalidCode/ErrNotFound; fixed custom-data field population and region/sub-region resolution by code; fuzz tests, benchmarks, and typo fixes.
validator / errutil
- Drop
go.uber.org/multierr:validatorbuilds its aggregate error viaerrors.Join; the per-failed-tag*Errorstructure, count, and order are unchanged. - Add
errutil.Errors, a dependency-free helper that enumerates the individual errors held in anerrors.Joinaggregate.
Maintenance
- Updated dependencies.
Full Changelog: v1.140.0...v1.141.0