refactor: use runtime rather than ldflags for go details (#1302)
This commit is contained in:
parent
6f68f4056e
commit
2cd3248431
2 changed files with 8 additions and 9 deletions
2
Makefile
2
Makefile
|
@ -50,11 +50,9 @@ DEFAULT_DATADIR ?= "/var/lib/crowdsec/data"
|
|||
|
||||
LD_OPTS_VARS= \
|
||||
-X github.com/crowdsecurity/crowdsec/pkg/cwversion.Version=$(BUILD_VERSION) \
|
||||
-X github.com/crowdsecurity/crowdsec/pkg/cwversion.System=$(SYSTEM) \
|
||||
-X github.com/crowdsecurity/crowdsec/pkg/cwversion.BuildDate=$(BUILD_TIMESTAMP) \
|
||||
-X github.com/crowdsecurity/crowdsec/pkg/cwversion.Codename=$(BUILD_CODENAME) \
|
||||
-X github.com/crowdsecurity/crowdsec/pkg/cwversion.Tag=$(BUILD_TAG) \
|
||||
-X github.com/crowdsecurity/crowdsec/pkg/cwversion.GoVersion=$(BUILD_GOVERSION) \
|
||||
-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultConfigDir=$(DEFAULT_CONFIGDIR) \
|
||||
-X github.com/crowdsecurity/crowdsec/pkg/csconfig.defaultDataDir=$(DEFAULT_DATADIR)
|
||||
|
||||
|
|
|
@ -5,6 +5,7 @@ import (
|
|||
"fmt"
|
||||
"log"
|
||||
"net/http"
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
version "github.com/hashicorp/go-version"
|
||||
|
@ -25,10 +26,10 @@ Additional labels for pre-release and build metadata are available as extensions
|
|||
var (
|
||||
Version string // = "v0.0.0"
|
||||
Codename string // = "SoumSoum"
|
||||
BuildDate string // = "I don't remember exactly"
|
||||
BuildDate string // = "0000-00-00_00:00:00"
|
||||
Tag string // = "dev"
|
||||
GoVersion string // = "1.13"
|
||||
System string // = "linux"
|
||||
GoVersion = runtime.Version()[2:] // = "1.13"
|
||||
System = runtime.GOOS // = "linux"
|
||||
Constraint_parser = ">= 1.0, <= 2.0"
|
||||
Constraint_scenario = ">= 1.0, < 3.0"
|
||||
Constraint_api = "v1"
|
||||
|
|
Loading…
Reference in a new issue