unexport version

This commit is contained in:
aler9 2020-11-24 21:45:44 +01:00
parent c929f3d963
commit 359a7f0f2f
2 changed files with 6 additions and 7 deletions

View File

@ -124,7 +124,7 @@ release:
release-nodocker:
$(eval export CGO_ENABLED=0)
$(eval VERSION := $(shell git describe --tags))
$(eval GOBUILD := go build -ldflags '-X main.Version=$(VERSION)')
$(eval GOBUILD := go build -ldflags '-X main.version=$(VERSION)')
rm -rf tmp && mkdir tmp
rm -rf release && mkdir release
cp rtsp-simple-server.yml tmp/
@ -157,7 +157,7 @@ COPY . ./
ARG VERSION
ARG OPTS
RUN export CGO_ENABLED=0 $${OPTS} \
&& go build -ldflags "-X main.Version=$$VERSION" -o /rtsp-simple-server
&& go build -ldflags "-X main.version=$$VERSION" -o /rtsp-simple-server
FROM scratch
COPY --from=build /rtsp-simple-server /

View File

@ -22,8 +22,7 @@ import (
"github.com/aler9/rtsp-simple-server/internal/stats"
)
// Version can be overridden by build flags.
var Version = "v0.0.0"
var version = "v0.0.0"
type program struct {
confPath string
@ -45,7 +44,7 @@ type program struct {
func newProgram(args []string) (*program, error) {
k := kingpin.New("rtsp-simple-server",
"rtsp-simple-server "+Version+"\n\nRTSP server.")
"rtsp-simple-server "+version+"\n\nRTSP server.")
argVersion := k.Flag("version", "print version").Bool()
argConfPath := k.Arg("confpath", "path to a config file. The default is rtsp-simple-server.yml.").Default("rtsp-simple-server.yml").String()
@ -53,7 +52,7 @@ func newProgram(args []string) (*program, error) {
kingpin.MustParse(k.Parse(args))
if *argVersion == true {
fmt.Println(Version)
fmt.Println(version)
os.Exit(0)
}
@ -129,7 +128,7 @@ func (p *program) createResources(initial bool) error {
}
if initial {
p.Log("rtsp-simple-server %s", Version)
p.Log("rtsp-simple-server %s", version)
}
if p.conf.Metrics {