// Package main provides the application entry point for the Go Platform. package main import ( "context" "fmt" "os" "git.dcentral.systems/toolz/goplt/internal/di" "git.dcentral.systems/toolz/goplt/internal/infra/database" "git.dcentral.systems/toolz/goplt/internal/server" "git.dcentral.systems/toolz/goplt/pkg/logger" "go.uber.org/fx" ) func main() { // Create DI container with lifecycle hooks // We need to invoke the HTTP server to ensure all providers execute container := di.NewContainer( // Invoke lifecycle hooks fx.Invoke(di.RegisterLifecycleHooks), // Force HTTP server to be created (which triggers all dependencies) // This ensures database, health, metrics, etc. are all created fx.Invoke(func(_ *server.Server, _ *database.Client) { // Both server and database are created, hooks are registered // This ensures all providers execute }), ) // Create root context ctx := context.Background() // Start the application if err := container.Start(ctx); err != nil { log := logger.GetGlobalLogger() if log != nil { log.Error("Failed to start application", logger.Error(err), ) } else { fmt.Fprintf(os.Stderr, "Failed to start application: %v\n", err) } os.Exit(1) } }