fix version string maybe
This commit is contained in:
parent
5bccac44d6
commit
6f409bf0f1
2 changed files with 23 additions and 1 deletions
18
config/version.go
Normal file
18
config/version.go
Normal file
|
@ -0,0 +1,18 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"runtime/debug"
|
||||
|
||||
"github.com/sirupsen/logrus"
|
||||
)
|
||||
|
||||
var BuildInfo *debug.BuildInfo
|
||||
|
||||
func init() {
|
||||
var ok bool
|
||||
BuildInfo, ok = debug.ReadBuildInfo()
|
||||
if !ok {
|
||||
logrus.Error("failed to read build info")
|
||||
return
|
||||
}
|
||||
}
|
|
@ -2,10 +2,12 @@ package httpserver
|
|||
|
||||
import (
|
||||
"embed"
|
||||
"fmt"
|
||||
"html/template"
|
||||
"io"
|
||||
"io/fs"
|
||||
|
||||
"git.janky.solutions/finn/go-project-template/config"
|
||||
echo "github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
|
@ -15,7 +17,9 @@ var (
|
|||
templatesSubFS fs.FS
|
||||
allTemplates *template.Template
|
||||
funcs = template.FuncMap{
|
||||
"version": func() string { return "everybody v0.0.0 fakecommit" },
|
||||
"version": func() string {
|
||||
return fmt.Sprintf("%s %s", config.BuildInfo.Main.Path, config.BuildInfo.Main.Version)
|
||||
},
|
||||
}
|
||||
|
||||
//go:embed static
|
||||
|
|
Loading…
Reference in a new issue