package version
parent
d5164a5197
commit
9920382953
|
@ -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"]
|
5
main.go
5
main.go
|
@ -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)
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,3 @@
|
||||||
|
package version
|
||||||
|
|
||||||
|
var Version = "dev"
|
Loading…
Reference in New Issue