impr: goreleaser-compatible version, commit and date

This commit is contained in:
Anton
2024-01-18 00:34:49 +05:00
parent 8178918c6e
commit 02473a2b61
2 changed files with 9 additions and 6 deletions

View File

@@ -13,11 +13,16 @@ import (
"github.com/nalgeon/codapi/internal/server"
)
var Version string = "main"
// set by the build process
var (
version = "main"
commit = "none"
date = "unknown"
)
// startServer starts the HTTP API sandbox server.
func startServer(port int) *server.Server {
logx.Log("codapi %s", Version)
logx.Log("codapi %s, commit %s, built at %s", version, commit, date)
logx.Log("listening on port %d...", port)
router := server.NewRouter()
srv := server.NewServer(port, router)