From 74ff984906ea25ff567ccd78ddc3f9cae13f53f3 Mon Sep 17 00:00:00 2001 From: Tyler Stiene Date: Sat, 16 Jan 2021 14:06:58 -0500 Subject: [PATCH] chore: move cpu profile into main --- Makefile | 3 +++ main.go | 5 +++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 6a829b6..4f84264 100644 --- a/Makefile +++ b/Makefile @@ -6,6 +6,9 @@ mumble-discord-bridge: $(GOFILES) dev: $(GOFILES) goreleaser build --skip-validate --rm-dist && sudo ./dist/mumble-discord-bridge_linux_amd64/mumble-discord-bridge +dev-profile: $(GOFILES) + goreleaser build --skip-validate --rm-dist && sudo ./dist/mumble-discord-bridge_linux_amd64/mumble-discord-bridge -cpuprofile cpu.prof + docker-latest: docker build -t stieneee/mumble-discord-bridge:latest . docker push stieneee/mumble-discord-bridge:latest diff --git a/main.go b/main.go index 5c5d4b7..a9c23c7 100644 --- a/main.go +++ b/main.go @@ -25,8 +25,6 @@ var ( date string ) -var cpuprofile = flag.String("cpuprofile", "", "write cpu profile to `file`") - func main() { log.Println("Mumble-Discord-Bridge") log.Println("v" + version + " " + commit + " " + date) @@ -45,6 +43,9 @@ func main() { discordCommand := flag.String("discord-command", lookupEnvOrString("DISCORD_COMMAND", "mumble-discord"), "DISCORD_COMMAND,Discord command string, env alt DISCORD_COMMAND, optional, defaults to mumble-discord") mode := flag.String("mode", lookupEnvOrString("MODE", "constant"), "MODE,determine which mode the bridge starts in") nice := flag.Bool("nice", lookupEnvOrBool("NICE", false), "NICE,whether the bridge should automatically try to 'nice' itself") + + cpuprofile := flag.String("cpuprofile", "", "write cpu profile to `file`") + flag.Parse() log.Printf("app.config %v\n", getConfig(flag.CommandLine))