Help us shape the future of Go! Take the 2026 Go Developer Survey

common

package module
v0.3.0-rc.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 0 Imported by: 0

README

common-go

Shared Go foundations for Gym microservices.

Status

develop is an unreleased G2 source line; no common-go release tag exists. It pins the published github.com/pploc/proto-go v1.1.0 contract without a replace directive.

Packages

  • auth, errors, grpc/interceptor, grpc/middleware, logging, and observability provide trusted-claim extraction, safe error mapping, gRPC policies, logging, and W3C propagation.
  • kafka provides acknowledged concrete-Protobuf publishing and a private franz-go adapter behind project-owned interfaces.

Kafka transport

  • Uses Confluent Schema Registry framing with TopicNameStrategy and runtime lookup-only schema resolution.
  • Disables consumer auto-commit and processes raw broker records through FranzConsumer.Run and Delivery.Process.
  • Retries after 2s, 4s, and 8s. Successful handling or confirmed raw DLQ publishing commits the source record; a failed DLQ write, cancellation, or unfinished delivery leaves it eligible for redelivery.
  • {topic}.DLQ preserves the original key, framed value, and ordered headers, adding only contract diagnostic headers.

This transport is at-least-once. Services own idempotency and transactional outboxes.

Verification

go install honnef.co/go/tools/cmd/staticcheck@v0.7.0
go install golang.org/x/vuln/cmd/govulncheck@v1.6.0
make verify

For Kafka/Registry validation, use the reusable repository workflow. It provisions Confluent Kafka and Schema Registry 7.7.1, verifies the immutable gym-proto v1.1.0 fixture input, and runs:

KAFKA_BROKERS=localhost:9092 SCHEMA_REGISTRY_URL=http://localhost:8081 make integration

Documentation

Overview

Package common provides shared contracts for the Gym microservices.

Feature packages are introduced incrementally after their cross-language contracts and compatibility fixtures are approved.

Directories

Path Synopsis
Package auth extracts gateway-injected request claims.
Package auth extracts gateway-injected request claims.
Package errors defines client-safe domain errors and gRPC conversion.
Package errors defines client-safe domain errors and gRPC conversion.
grpc
interceptor
Package interceptor provides composable gRPC server interceptors.
Package interceptor provides composable gRPC server interceptors.
middleware
Package middleware provides explicit gRPC authorization policies.
Package middleware provides explicit gRPC authorization policies.
internal
kafka
Package kafka contains franz-go transport code kept private from consumers of github.com/pploc/common-go/kafka.
Package kafka contains franz-go transport code kept private from consumers of github.com/pploc/common-go/kafka.
Package kafka provides the project-owned Kafka foundation API.
Package kafka provides the project-owned Kafka foundation API.
Package logging provides safe structured logger context helpers.
Package logging provides safe structured logger context helpers.
Package observability provides opt-in OpenTelemetry helpers.
Package observability provides opt-in OpenTelemetry helpers.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL