package version

pull/7/head
sundowndev 2021-07-07 16:05:58 +02:00
parent d5164a5197
commit 9920382953
3 changed files with 6 additions and 4 deletions

View File

@ -8,6 +8,6 @@ RUN apk add git
RUN go mod download RUN go mod download
RUN VERSION=$(git describe --exact-match 2>/dev/null || git rev-parse --short HEAD) RUN VERSION=$(git describe --exact-match 2>/dev/null || git rev-parse --short HEAD)
RUN go build -ldflags="-X github.com/sundowndev/goreleaser-template.version=${VERSION}" -v -o myproject . RUN go build -ldflags="-X github.com/sundowndev/goreleaser-template/version.Version=${VERSION}" -v -o myproject .
ENTRYPOINT ["/app/myproject"] ENTRYPOINT ["/app/myproject"]

View File

@ -2,10 +2,9 @@ package main
import ( import (
"fmt" "fmt"
"github.com/sundowndev/goreleaser-template/version"
) )
var version = "dev"
func main() { func main() {
fmt.Println("Hello, world!", version) fmt.Println("Hello, world!", version.Version)
} }

3
version/version.go Normal file
View File

@ -0,0 +1,3 @@
package version
var Version = "dev"