mirror of
https://codeberg.org/gothub/gothub
synced 2024-12-06 19:16:24 +01:00
It's not necessary to build commit info to ldflags now.
Signed-off-by: Odyssey <odyssey346@disroot.org>
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@ RUN apk --no-cache add git
|
||||
RUN git clone https://codeberg.org/gothub/gothub .
|
||||
|
||||
RUN go mod download
|
||||
RUN GOOS=linux GOARCH=$TARGETARCH go build -ldflags "-X codeberg.org/gothub/gothub/pages.Version=$(git rev-parse --short HEAD)" -o /src/gothub
|
||||
RUN GOOS=linux GOARCH=$TARGETARCH go build -o /src/gothub
|
||||
|
||||
FROM scratch as bin
|
||||
|
||||
|
||||
+16
-2
@@ -1,8 +1,22 @@
|
||||
package pages
|
||||
|
||||
import "github.com/gofiber/fiber/v2"
|
||||
import (
|
||||
"runtime/debug"
|
||||
|
||||
var Version = "unknown"
|
||||
"github.com/gofiber/fiber/v2"
|
||||
)
|
||||
|
||||
// taken from https://git.vern.cc/pjals/bestofbot.
|
||||
var Version = func() string {
|
||||
if info, ok := debug.ReadBuildInfo(); ok {
|
||||
for _, setting := range info.Settings {
|
||||
if setting.Key == "vcs.revision" {
|
||||
return setting.Value[:8]
|
||||
}
|
||||
}
|
||||
}
|
||||
return "AGPLVIOLATION"
|
||||
}()
|
||||
|
||||
func HandleIndex(c *fiber.Ctx) error {
|
||||
return c.Render("index", fiber.Map{
|
||||
|
||||
Reference in New Issue
Block a user