-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pprof with buildflags, not runtime flags
- Loading branch information
Showing
5 changed files
with
28 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
//go:build debug | ||
|
||
package main | ||
|
||
import ( | ||
"net/http" | ||
_ "net/http/pprof" | ||
) | ||
|
||
func init() { | ||
// Assume you have a function setupDebugHandlers to register debug routes | ||
setupDebugHandlers() | ||
} | ||
|
||
func setupDebugHandlers() { | ||
// Register your pprof handlers or other debug routes here | ||
// Since "net/http/pprof" is imported above, its init function automatically registers its routes with the default mux | ||
go http.ListenAndServe("localhost:6060", nil) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters