Skip to content

v1.141.0

Choose a tag to compare

@github-actions github-actions released this 08 Jul 21:58
7533682

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/multierr dependency dropped. kafka, validator, and errutil now use the standard library's errors.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 via errors.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.LimitReader for connection reuse, non-2xx snippets (secret-redacted) are appended to errors, and nil-request/nil-body guards replace latent panics.

Breaking changes

  • pkg/kafkacgo removed. Migrate to github.com/tecnickcom/gogen/pkg/kafka (context-native, no CGO); note the option/error surface differs (segmentio/kafka-go rather than librdkafka).
  • kafka: NewProducer/NewConsumer validate at construction and return errors matching ErrInvalidOptions/ErrNilEncodeFunc/ErrNilDecodeFunc; NewProducer's urls parameter renamed to brokers; Receive/FetchMessage/ReceiveData return ErrConsumerClosed after Close (no longer wrap io.EOF).
  • redis: Get/GetData return ErrKeyNotFound (no longer matches redis.Nil); WithSubscrChannelsWithChannels, WithSubscrChannelOptionsWithChannelOptions; empty channel names and Addr/Network mismatches rejected at construction.
  • valkey: subscription lifetime is bound to Close rather than the New context (Close is now mandatory when channels are configured); Get/GetData return ErrKeyNotFound (no longer matches valkeygo.Nil/IsValkeyNil); empty channel names rejected.
  • ipify: a 200 with an empty body now returns ErrInvalidResponse, non-http/https URLs are rejected at construction, and the response body is capped at 64 bytes.
  • devlake / jirasrv / sleuth: New validates retry options (ErrInvalidRetryConfig) at construction; retries now honor a server-provided Retry-After (capped at 60s); error message texts changed.
  • slack: HealthCheck now fails during an active Apps/Integrations/APIs incident (previously it could never fail); default ping URL changed to https://slack-status.com; retry validation moved to construction.
  • countryphone: NumInfo.Geo changes from []*GeoInfo to []GeoInfo; removed the unused PrefixData alias; dropped non-ISO codes CT (+90) and QN (+374) so +90TR and +374AM only.
  • countrycode: internal length/character/parse errors now wrap the exported ErrInvalidCode/ErrNotFound.
  • validator: the aggregate error from ValidateStruct/ValidateStructCtx now renders with newline separators (errors.Join) instead of multierr's "; ". The error type, errors.Is/errors.As traversal, and one-*Error-per-failed-tag structure are unchanged; only the concatenated Error() string differs.

Changes by package

kafka

  • Sentinel errors ErrInvalidOptions, ErrNilEncodeFunc, ErrNilDecodeFunc, ErrConsumerClosed.
  • WithKafkaReader/WithKafkaWriter inject an existing kafka-go reader/writer (via new KReader/KWriter interfaces) for dependency-free tests.
  • Add Producer.HealthCheck and WithBrokerCheckFunc (custom per-broker probe).
  • Replace go.uber.org/multierr with stdlib errors.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; WithRedisClient injection; idempotent Close.
  • Extensive doc and test rework (key-not-found, double Close, concurrent Close, nil-message skipping, unix socket validation); coverage stays 100%.

valkey

  • Sentinel errors mirroring redis; deterministic clean-closure reporting via an atomic closed flag; idempotent Close via sync.Once.
  • Skip InitAddress validation when a client is injected via WithValkeyClient.

ipify

  • Export ErrInvalidOptions/ErrInvalidResponse; URL validation at construction; nil-body guard; add Client.HealthCheck.

devlake / jirasrv / sleuth

  • Sentinel errors, single prebuilt retrier (method-aware read/write retriers in jirasrv), Retry-After support, 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: validator builds its aggregate error via errors.Join; the per-failed-tag *Error structure, count, and order are unchanged.
  • Add errutil.Errors, a dependency-free helper that enumerates the individual errors held in an errors.Join aggregate.

Maintenance

  • Updated dependencies.

Full Changelog: v1.140.0...v1.141.0