Problem
main (cmd/server/cmd.go:36-40) sets up what looks like a profiling endpoint:
runtime.SetBlockProfileRate(1)
runtime.SetMutexProfileFraction(1)
go func() {
log.Fatal(http.ListenAndServe("localhost:6060", nil))
}()
net/http/pprof is not imported, so nothing is registered on http.DefaultServeMux — localhost:6060 only returns 404. The server is dead weight.
log.Fatal inside the goroutine terminates the whole myshoes process if port 6060 is taken (e.g. two instances on one host).
SetBlockProfileRate(1) / SetMutexProfileFraction(1) sample every blocking/mutex event unconditionally in production, which has measurable overhead.
Suggested fix
- Import
_ "net/http/pprof" so the endpoint actually works.
- Log the listen error instead of
log.Fatal.
- Gate the debug server and the profile rates behind an env var (e.g.
MYSHOES_PPROF=1), or at least use saner rates.
Problem
main(cmd/server/cmd.go:36-40) sets up what looks like a profiling endpoint:net/http/pprofis not imported, so nothing is registered onhttp.DefaultServeMux—localhost:6060only returns 404. The server is dead weight.log.Fatalinside the goroutine terminates the whole myshoes process if port 6060 is taken (e.g. two instances on one host).SetBlockProfileRate(1)/SetMutexProfileFraction(1)sample every blocking/mutex event unconditionally in production, which has measurable overhead.Suggested fix
_ "net/http/pprof"so the endpoint actually works.log.Fatal.MYSHOES_PPROF=1), or at least use saner rates.