Skip to content

Commit a171980

Browse files
authored
Merge pull request #82 from raspbeguy/fix-version
fix(): make version a build-time injectable variable
2 parents 1707bdd + bc37bbd commit a171980

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ jobs:
2626
2727
- name: Build
2828
run: |
29-
go build ./...
29+
go build -ldflags "-X main.Version=${{ github.ref }}" ./...
3030
env:
3131
CGO_ENABLED: 0
3232

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
1.15.0
1+
1.15.1

main.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
)
1616

1717
var (
18-
version = "0.0.0"
18+
Version string
1919
)
2020

2121
func main() {
@@ -59,7 +59,7 @@ func main() {
5959
}
6060

6161
log.Warnf("Listening on %s, sending to %s", cfg.Listen, cfg.Target)
62-
log.Warnf("Started v%s", version)
62+
log.Warnf("Started v%s", Version)
6363

6464
ch := make(chan os.Signal, 1)
6565
signal.Notify(ch, syscall.SIGTERM, os.Interrupt)

0 commit comments

Comments
 (0)