main.go
 1package main
 2
 3import (
 4	"log/slog"
 5	"net/http"
 6	_ "net/http/pprof"
 7	"os"
 8
 9	"github.com/charmbracelet/crush/internal/cmd"
10	_ "github.com/joho/godotenv/autoload"
11)
12
13func main() {
14	if os.Getenv("CRUSH_PROFILE") != "" {
15		go func() {
16			slog.Info("Serving pprof at localhost:6060")
17			if httpErr := http.ListenAndServe("localhost:6060", nil); httpErr != nil {
18				slog.Error("Failed to pprof listen", "error", httpErr)
19			}
20		}()
21	}
22
23	cmd.Execute()
24}