Skip to content

Commit

Permalink
feat: add debug info to webthingy
Browse files Browse the repository at this point in the history
show all the build info

Signed-off-by: Caleb Woodbine <[email protected]>
  • Loading branch information
BobyMCbobs committed May 31, 2023
1 parent 3292314 commit c3d2230
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions cmd/webthingy/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"fmt"
"log"
"net/http"
"runtime/debug"
"time"

"github.com/BobyMCbobs/sample-ko-monorepo/pkg/common"
Expand Down Expand Up @@ -44,6 +45,15 @@ func NewWebThingy() *WebThingy {
}

func (w *WebThingy) Run() {
info, _ := debug.ReadBuildInfo()
var debugInfo string
for _, i := range info.Settings {
switch i.Key {
case "vcs.revision", "vcs.time", "vcs.modified":
debugInfo += i.Key + " " + i.Value + " "
}
}
log.Printf("%v", debugInfo)
log.Printf("Listening on HTTP port '%v'\n", w.server.Addr)
log.Fatal(w.server.ListenAndServe())
}
Expand Down

0 comments on commit c3d2230

Please sign in to comment.