ref: 02efb65bef2e1645809ac16676f218618ea2378b
parent: 14630e6655b35d67421d42eef253121be1ce795d
author: Runxi Yu <runxiyu@umich.edu>
date: Sun Mar 29 11:04:19 EDT 2026
cmd/receivepack9418: Actually I do need return here because defer.
--- a/cmd/receivepack9418/main.go
+++ b/cmd/receivepack9418/main.go
@@ -8,6 +8,10 @@
)
func main() {+ os.Exit(runMain())
+}
+
+func runMain() int { listenAddr := flag.String("listen", ":9418", "listen address") repoPath := flag.String("repo", "", "path to git dir (.git or bare repo root)") cpuProfilePath := flag.String("cpuprofile", "", "write CPU profile to file")@@ -18,7 +22,7 @@
if *repoPath == "" { log.Print("must provide -repo <path-to-git-dir>")- os.Exit(2)
+ return 2
}
if *cpuProfilePath != "" {@@ -26,7 +30,7 @@
if err != nil { log.Printf("cpuprofile: %v", err)- os.Exit(1)
+ return 1
}
defer func() {@@ -50,8 +54,8 @@
if err != nil { log.Printf("run: %v", err)- os.Exit(1)
+ return 1
}
- os.Exit(0)
+ return 0
}
--
⑨