main.go 447 B

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