memory-bank/components/common-go.md
The Common-Go component is a foundational Go library that provides shared utilities, abstractions, and functionality used across multiple Gitpod services. It serves as a central repository for common code patterns, helping to maintain consistency, reduce duplication, and simplify development across the Gitpod platform's Go-based microservices.
The primary purposes of the Common-Go component are:
The Common-Go component is structured as a collection of Go packages, each focusing on a specific area of functionality:
The component is designed to be imported and used by other Go-based services in the Gitpod platform, providing a consistent foundation for service development.
components/scrubber: For data scrubbing and sanitizationThe Common-Go component integrates with:
srv, err := baseserver.New("service-name",
baseserver.WithVersion(version),
baseserver.WithConfig(cfg.Server),
)
if err != nil {
log.WithError(err).Fatal("failed to initialize server")
}
log.WithFields(log.Fields{
"user": userID,
"workspace": workspaceID,
}).Info("workspace started")
span, ctx := tracing.FromContext(ctx, "operation-name")
defer span.Finish()
span.SetTag("key", "value")
counter := prometheus.NewCounter(prometheus.CounterOpts{
Name: "operation_total",
Help: "Total number of operations performed",
})
metrics.Registry.MustRegister(counter)
counter.Inc()
The Common-Go component is typically used to: