From 91c591e22f0d20afa321ef584dedab0157157ab9 Mon Sep 17 00:00:00 2001 From: James Wells Date: Thu, 26 Dec 2024 14:30:23 -0800 Subject: [PATCH] Fixing a compliation error and possibly versioning. --- .forgejo/workflows/build.yaml | 4 ++-- cmd/gagent/main.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.forgejo/workflows/build.yaml b/.forgejo/workflows/build.yaml index 11238a0..523741c 100644 --- a/.forgejo/workflows/build.yaml +++ b/.forgejo/workflows/build.yaml @@ -36,7 +36,7 @@ jobs: - uses: actions/checkout@v4 - - run: go build -o test_artifact cmd/hello/main.go + - run: go build -o test_artifact cmd/gagent/main.go - run: ./test_artifact --version - uses: actions/upload-artifact@v3 @@ -50,7 +50,7 @@ jobs: container: image: dragonheim/golang:latest steps: - - run: apk add --no-cache nodejs npm + - run: apk add --no-cache zeromq-dev nodejs npm - uses: actions/download-artifact@v3 with: name: test_artifact diff --git a/cmd/gagent/main.go b/cmd/gagent/main.go index c7e4db2..ac0191b 100644 --- a/cmd/gagent/main.go +++ b/cmd/gagent/main.go @@ -1,11 +1,11 @@ package main import ( - debug "runtime/debug" flag "flag" log "log" http "net/http" os "os" + debug "runtime/debug" strconv "strconv" sync "sync" @@ -31,7 +31,6 @@ import ( promhttp "github.com/prometheus/client_golang/prometheus/promhttp" uuid "github.com/jakehl/goid" - //versioninfo "github.com/carlmjohnson/versioninfo" ) @@ -152,7 +151,8 @@ func init() { /* * Initialize the configuration */ - config.Version, err = debug.ReadBuildInfo() + buildInfo, _ := debug.ReadBuildInfo() + config.Version = buildInfo.Main.Version // config.Version = versioninfo.Version config.File = cfg.ConfigFile @@ -228,7 +228,7 @@ func init() { usage += "Options:\n" usage += " -h, --help -- Show this help screen and exit\n" - usage += " -v, -version -- Show version and exit\n" + usage += " -v, --version -- Show version and exit\n" usage += " --config= -- [default: /etc/gagent/gagent.hcl]\n" usage += " --agent= -- filename of the agent to be uploaded to the G'Agent network. Required in push mode\n" usage += "\n"