Course · Training · Workshop

Go for Enterprise Services

Idiomatic Go for experienced Java teams: build services contract-first with OpenAPI, structure projects cleanly, connect messaging, share internal libraries and run Go services that are testable, observable and production-ready.

Many enterprise teams use Go for platform tools, integration services and microservices – and at first often write Java in Go syntax: deep package hierarchies, large interfaces, exception thinking and a framework for everything. This course shows what idiomatic Go looks like in an enterprise environment and why the language deliberately gets by with few concepts. Participants build a service contract-first: an OpenAPI specification, server code generated with go:generate, Swagger UI, cleanly layered handlers, a connection to a message queue and a consumer that processes the events. On top of that come the questions that really matter day to day: How do I structure a Go project and a monorepo? How do I build an internal library for configuration, LDAP or logging that other teams are happy to use? What does a middleware chain look like? And when is Go the right choice – and when is Java the better one?

What participants say

* Voices from this or related courses.

These customers booked courses in the same topic cluster.More customers →

Content

The course consists of the following topics and is tailored to the team’s architecture, libraries and platform for in-house sessions. We work throughout on a realistic service with an API contract, a messaging backend and deployment to Docker and Kubernetes.

– Go from a Java perspective:

  • What Go deliberately leaves out: inheritance, exceptions, annotations, heavy frameworks
  • Composition over inheritance, structs, methods and embedding
  • Defining small interfaces at the consumer – implicit implementation
  • Errors as values: wrapping, errors.Is and errors.As, sentinel and custom errors
  • When Go, when Java: criteria for the team’s technology choice
  • Hands-On: refactor typical Java-style code into idiomatic Go – Structuring projects and modules:
  • Go modules, versioning and private modules in the enterprise
  • Project layout: cmd/, internal/, packages by responsibility instead of by layer
  • Monorepo or many repos, workspaces and dependencies
  • Hands-On: set up a service project and split it into packages – REST services contract-first with OpenAPI:
  • OpenAPI specification as the contract between teams
  • Generating server and client code with oapi-codegen and go:generate
  • net/http routing, handlers, request validation and JSON
  • Swagger UI for documenting and trying out the API
  • Hands-On: write the API contract, generate code and implement the service – Middleware and the request pipeline:
  • Middleware chains for logging, authentication, tracing and recovery
  • context.Context for timeouts, cancellation and request data
  • Loading configuration: environment variables, files, defaults
  • Hands-On: build your own middleware chain for the service – Messaging and asynchronous processing:
  • Publishing and consuming events with a message queue (e.g. NATS, RabbitMQ or Kafka)
  • Goroutines, channels and sync primitives in a service context
  • Worker pools, backpressure, retries and idempotency
  • Hands-On: the service publishes events, a consumer processes them – Internal libraries for many teams:
  • Good library APIs: small surface, sensible defaults, functional options
  • Typical candidates: configuration, LDAP access, logging, HTTP clients
  • Versioning, compatibility and documentation with godoc
  • Hands-On: extract an internal library and use it in the service – Testing and quality:
  • Table-driven tests, subtests, httptest and test doubles without a mocking framework
  • Integration tests with containers
  • go vet, staticcheck, golangci-lint and the race detector in the pipeline
  • Hands-On: cover the service and consumer with unit and integration tests – Operations and observability:
  • Structured logging with log/slog, metrics and traces with OpenTelemetry
  • Health checks, graceful shutdown and sensible timeouts
  • Container images with multi-stage builds and deployment to Kubernetes
  • Hands-On: run the service and message queue in the Labmachine’s Kubernetes cluster

The goal is not to get to know as many libraries as possible, but to write Go the way it is meant to be written: simple, explicit and readable – so that Go services in the enterprise become just as maintainable as the existing Java systems.

The actual course content may differ from the above depending on the trainer, delivery, duration and the composition of participants.

Request this course in-house

By submitting you accept our Privacy Policy.

Request a public date

No suitable public date? Register without obligation — once there is enough interest we schedule a new public date and let you know first.

Number of participants (approx.)

More than 3 participants? Best to request a dedicated in-house date directly.

By submitting you accept our Privacy Policy.

More about Go in the enterprise

Go was designed at Google for exactly the problems large organisations have: many teams, large codebases, long build times and services that must run reliably and efficiently. Today Go is the language behind Kubernetes, Docker, Terraform and Prometheus – and is used by banks, insurers, energy and retail companies for platform tools, integration services and APIs, often right next to existing Java landscapes.

Further resources:

History

Go was created at Google in 2007, when Robert Griesemer, Rob Pike and Ken Thompson set out to build a language that combines the productivity of dynamic languages with the safety and performance of compiled ones – and stays readable in codebases with thousands of developers. Since Go 1.0 (2012), the compatibility promise has made Go attractive for long-lived enterprise software.

With Docker and Kubernetes, Go became the language of cloud-native infrastructure. Go Modules (1.11), generics (1.18), structured logging with log/slog (1.21) and the extended routing in net/http (1.22) have grown the standard library to the point where many enterprise services no longer need heavyweight frameworks.