Value injection at build time seems to only work for the main package
This commit is contained in:
19
main.go
19
main.go
@@ -1,6 +1,8 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
log "github.com/sirupsen/logrus"
|
||||
|
||||
"github.com/gabek/owncast/config"
|
||||
@@ -8,9 +10,19 @@ import (
|
||||
"github.com/gabek/owncast/router"
|
||||
)
|
||||
|
||||
// the following are injected at build-time
|
||||
var (
|
||||
//GitCommit is the commit which this version of owncast is running
|
||||
GitCommit = "unknown"
|
||||
//BuildVersion is the version
|
||||
BuildVersion = "0.0.0"
|
||||
//BuildType is the type of build
|
||||
BuildType = "localdev"
|
||||
)
|
||||
|
||||
func main() {
|
||||
// logrus.SetReportCaller(true)
|
||||
log.Println(core.GetVersion())
|
||||
log.Println(getVersion())
|
||||
|
||||
//TODO: potentially load the config from a flag like:
|
||||
//configFile := flag.String("configFile", "config.yaml", "Config File full path. Defaults to current folder")
|
||||
@@ -31,3 +43,8 @@ func main() {
|
||||
panic(err)
|
||||
}
|
||||
}
|
||||
|
||||
//getVersion gets the version string
|
||||
func getVersion() string {
|
||||
return fmt.Sprintf("Owncast v%s-%s (%s)", BuildVersion, BuildType, GitCommit)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user