mirror of
https://github.com/Kyren223/eko.git
synced 2025-09-05 21:18:14 +00:00
Converted buildDate to unix to prevent cache invalidation due to impure
date
This commit is contained in:
@@ -20,6 +20,8 @@ import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/kyren223/eko/embeds"
|
||||
"github.com/kyren223/eko/internal/client"
|
||||
@@ -29,7 +31,14 @@ func main() {
|
||||
if len(os.Args) > 1 && os.Args[1] == "-v" {
|
||||
fmt.Println("version:", embeds.Version)
|
||||
fmt.Println("commit:", embeds.Commit)
|
||||
fmt.Println("build date:", embeds.BuildDate)
|
||||
buildDate := embeds.BuildDate
|
||||
if buildDate != "unknown" {
|
||||
t, err := strconv.ParseInt(buildDate, 10, 64)
|
||||
if err == nil {
|
||||
buildDate = time.Unix(t, 0).Format("2006-01-02")
|
||||
}
|
||||
}
|
||||
fmt.Println("build date:", buildDate)
|
||||
return
|
||||
}
|
||||
|
||||
|
@@ -26,13 +26,10 @@ import (
|
||||
"os"
|
||||
"os/signal"
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"syscall"
|
||||
"time"
|
||||
|
||||
// "github.com/grafana/pyroscope-go"
|
||||
// _ "github.com/grafana/pyroscope-go/godeltaprof/http/pprof"
|
||||
// _ "net/http/pprof"
|
||||
|
||||
"github.com/kyren223/eko/embeds"
|
||||
"github.com/kyren223/eko/internal/server"
|
||||
"github.com/kyren223/eko/internal/server/api"
|
||||
@@ -55,7 +52,14 @@ func main() {
|
||||
if len(os.Args) > 1 && os.Args[1] == "-v" {
|
||||
fmt.Println("version:", embeds.Version)
|
||||
fmt.Println("commit:", embeds.Commit)
|
||||
fmt.Println("build date:", embeds.BuildDate)
|
||||
buildDate := embeds.BuildDate
|
||||
if buildDate != "unknown" {
|
||||
t, err := strconv.ParseInt(buildDate, 10, 64)
|
||||
if err == nil {
|
||||
buildDate = time.Unix(t, 0).Format("2006-01-02")
|
||||
}
|
||||
}
|
||||
fmt.Println("build date:", buildDate)
|
||||
return
|
||||
}
|
||||
|
||||
|
13
flake.nix
13
flake.nix
@@ -22,19 +22,10 @@
|
||||
inherit system overlays;
|
||||
};
|
||||
version = (builtins.readFile ./VERSION);
|
||||
buildDate = builtins.readFile (
|
||||
pkgs.runCommand "build-date" { } ''
|
||||
${pkgs.coreutils}/bin/date --date=@${toString self.lastModified} +%Y-%m-%d -u > $out
|
||||
''
|
||||
);
|
||||
# buildDate = builtins.readFile (
|
||||
# pkgs.runCommand "build-date" { } ''
|
||||
# date -u +'%Y-%m-%d' > $out
|
||||
# ''
|
||||
# );
|
||||
buildDate = toString self.lastModified;
|
||||
commit = if (builtins.hasAttr "rev" self) then (builtins.substring 0 7 self.rev) else "unknown";
|
||||
# vendorHash = pkgs.lib.fakeHash;
|
||||
vendorHash = "sha256-2yCQ40T5N90lKpPOc+i6vz+1mI/p4Ey6PdRCJbGD+TE=";
|
||||
vendorHash = "sha256-dLhLFyrufv3dNlAw1QLlf9/LsHMcUaD9F2byKlC+35E=";
|
||||
src =
|
||||
let
|
||||
# Set this to `true` in order to show all of the source files
|
||||
|
Reference in New Issue
Block a user