aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--flake.nix1
-rw-r--r--internal/buildinfo.go26
-rw-r--r--internal/license.go10
3 files changed, 35 insertions, 2 deletions
diff --git a/flake.nix b/flake.nix
index 25bc2e6..c6403aa 100644
--- a/flake.nix
+++ b/flake.nix
@@ -323,6 +323,7 @@
gowasi
];
+ GOAMD64 = "v3";
XEDN_STATIC = self.packages.${system}.xedn-static;
};
}) // {
diff --git a/internal/buildinfo.go b/internal/buildinfo.go
new file mode 100644
index 0000000..b3f7390
--- /dev/null
+++ b/internal/buildinfo.go
@@ -0,0 +1,26 @@
+package internal
+
+import (
+ "encoding/json"
+ "net/http"
+ "runtime/debug"
+
+ "golang.org/x/exp/slog"
+)
+
+func init() {
+ http.HandleFunc("/.within/debug/buildinfo", func(w http.ResponseWriter, r *http.Request) {
+ bi, ok := debug.ReadBuildInfo()
+ if !ok {
+ slog.Error("can't read build info")
+ http.Error(w, "no build info available", http.StatusInternalServerError)
+ return
+ }
+
+ if err := json.NewEncoder(w).Encode(bi); err != nil {
+ slog.Error("can't encode build info", "err", err)
+ http.Error(w, err.Error(), http.StatusInternalServerError)
+ return
+ }
+ })
+}
diff --git a/internal/license.go b/internal/license.go
index bb4dc0b..7eead24 100644
--- a/internal/license.go
+++ b/internal/license.go
@@ -5,8 +5,8 @@ import (
"net/http"
"os"
- "within.website/x/cmd/license/licenses"
"go4.org/legal"
+ "within.website/x/cmd/license/licenses"
)
func init() {
@@ -17,10 +17,16 @@ func init() {
fmt.Fprintf(w, "Licenses for this program: %s\n", os.Args[0])
for _, li := range legal.Licenses() {
- fmt.Fprintln(w, li)
fmt.Fprintln(w)
+ fmt.Fprintln(w, "---")
+ fmt.Fprintln(w)
+ fmt.Fprintln(w, li)
}
+ fmt.Fprintln(w)
+ fmt.Fprintln(w, "---")
+ fmt.Fprintln(w)
+
fmt.Fprintln(w, "Be well, Creator.")
})
}