aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-11-13 07:29:46 +0900
committerOphestra <cat@gensokyo.uk>2025-11-13 07:29:46 +0900
commitbe0e387ab07c7d9f1441365a05c4c0141779184a (patch)
tree93ec7478d8d0faa320dfc86ad01cf39a364330c8
parentabeb67964f52f245f7d529e4dfe01f8347932bfd (diff)
internal/info: relocate from internal
This is cleaner and makes more sense. The longer LDFLAGS was never a valid concern since it is always inserted by a script. Signed-off-by: Ophestra <cat@gensokyo.uk>
-rw-r--r--cmd/hakurei/command.go4
-rw-r--r--cmd/hakurei/print.go20
-rw-r--r--cmd/hpkg/proc.go4
-rwxr-xr-xdist/release.sh6
-rw-r--r--internal/info/path.go (renamed from internal/path.go)2
-rw-r--r--internal/info/path_test.go (renamed from internal/path_test.go)2
-rw-r--r--internal/info/version.go (renamed from internal/version.go)2
-rw-r--r--internal/outcome/dispatcher.go4
-rw-r--r--internal/outcome/process.go4
-rw-r--r--package.nix2
10 files changed, 25 insertions, 25 deletions
diff --git a/cmd/hakurei/command.go b/cmd/hakurei/command.go
index 94fe7ead..2b0568e2 100644
--- a/cmd/hakurei/command.go
+++ b/cmd/hakurei/command.go
@@ -17,8 +17,8 @@ import (
"hakurei.app/container/check"
"hakurei.app/container/fhs"
"hakurei.app/hst"
- "hakurei.app/internal"
"hakurei.app/internal/env"
+ "hakurei.app/internal/info"
"hakurei.app/internal/outcome"
"hakurei.app/internal/system/dbus"
"hakurei.app/message"
@@ -353,7 +353,7 @@ func buildCommand(ctx context.Context, msg message.Msg, early *earlyHardeningErr
}).Flag(&flagShort, "short", command.BoolFlag(false), "Print instance id")
}
- c.Command("version", "Display version information", func(args []string) error { fmt.Println(internal.Version()); return errSuccess })
+ c.Command("version", "Display version information", func(args []string) error { fmt.Println(info.Version()); return errSuccess })
c.Command("license", "Show full license text", func(args []string) error { fmt.Println(license); return errSuccess })
c.Command("template", "Produce a config template", func(args []string) error { encodeJSON(log.Fatal, os.Stdout, false, hst.Template()); return errSuccess })
c.Command("help", "Show this help message", func([]string) error { c.PrintHelp(); return errSuccess })
diff --git a/cmd/hakurei/print.go b/cmd/hakurei/print.go
index 51358585..62131dbe 100644
--- a/cmd/hakurei/print.go
+++ b/cmd/hakurei/print.go
@@ -12,8 +12,8 @@ import (
"time"
"hakurei.app/hst"
- "hakurei.app/internal"
"hakurei.app/internal/env"
+ "hakurei.app/internal/info"
"hakurei.app/internal/outcome"
"hakurei.app/internal/store"
"hakurei.app/message"
@@ -24,20 +24,20 @@ func printShowSystem(output io.Writer, short, flagJSON bool) {
t := newPrinter(output)
defer t.MustFlush()
- info := &hst.Info{Version: internal.Version(), User: new(outcome.Hsu).MustID(nil)}
- env.CopyPaths().Copy(&info.Paths, info.User)
+ hi := &hst.Info{Version: info.Version(), User: new(outcome.Hsu).MustID(nil)}
+ env.CopyPaths().Copy(&hi.Paths, hi.User)
if flagJSON {
- encodeJSON(log.Fatal, output, short, info)
+ encodeJSON(log.Fatal, output, short, hi)
return
}
- t.Printf("Version:\t%s\n", info.Version)
- t.Printf("User:\t%d\n", info.User)
- t.Printf("TempDir:\t%s\n", info.TempDir)
- t.Printf("SharePath:\t%s\n", info.SharePath)
- t.Printf("RuntimePath:\t%s\n", info.RuntimePath)
- t.Printf("RunDirPath:\t%s\n", info.RunDirPath)
+ t.Printf("Version:\t%s\n", hi.Version)
+ t.Printf("User:\t%d\n", hi.User)
+ t.Printf("TempDir:\t%s\n", hi.TempDir)
+ t.Printf("SharePath:\t%s\n", hi.SharePath)
+ t.Printf("RuntimePath:\t%s\n", hi.RuntimePath)
+ t.Printf("RunDirPath:\t%s\n", hi.RunDirPath)
}
// printShowInstance writes a representation of [hst.State] or [hst.Config] to output.
diff --git a/cmd/hpkg/proc.go b/cmd/hpkg/proc.go
index 013e0b69..aca2db42 100644
--- a/cmd/hpkg/proc.go
+++ b/cmd/hpkg/proc.go
@@ -10,11 +10,11 @@ import (
"os/exec"
"hakurei.app/hst"
- "hakurei.app/internal"
+ "hakurei.app/internal/info"
"hakurei.app/message"
)
-var hakureiPathVal = internal.MustHakureiPath().String()
+var hakureiPathVal = info.MustHakureiPath().String()
func mustRunApp(ctx context.Context, msg message.Msg, config *hst.Config, beforeFail func()) {
var (
diff --git a/dist/release.sh b/dist/release.sh
index 47b6fd01..4dcb278e 100755
--- a/dist/release.sh
+++ b/dist/release.sh
@@ -10,9 +10,9 @@ cp -rv "dist/comp" "${out}"
go generate ./...
go build -trimpath -v -o "${out}/bin/" -ldflags "-s -w -buildid= -extldflags '-static'
- -X hakurei.app/internal.buildVersion=${VERSION}
- -X hakurei.app/internal.hakureiPath=/usr/bin/hakurei
- -X hakurei.app/internal.hsuPath=/usr/bin/hsu
+ -X hakurei.app/internal/info.buildVersion=${VERSION}
+ -X hakurei.app/internal/info.hakureiPath=/usr/bin/hakurei
+ -X hakurei.app/internal/info.hsuPath=/usr/bin/hsu
-X main.hakureiPath=/usr/bin/hakurei" ./...
rm -f "./${out}.tar.gz" && tar -C dist -czf "${out}.tar.gz" "${pname}"
diff --git a/internal/path.go b/internal/info/path.go
index 85e93eaf..9f96734a 100644
--- a/internal/path.go
+++ b/internal/info/path.go
@@ -1,4 +1,4 @@
-package internal
+package info
import (
"log"
diff --git a/internal/path_test.go b/internal/info/path_test.go
index f670c786..3137ee6a 100644
--- a/internal/path_test.go
+++ b/internal/info/path_test.go
@@ -1,4 +1,4 @@
-package internal
+package info
import (
"reflect"
diff --git a/internal/version.go b/internal/info/version.go
index 5c671084..8e722f78 100644
--- a/internal/version.go
+++ b/internal/info/version.go
@@ -1,4 +1,4 @@
-package internal
+package info
// FallbackVersion is returned when a version string was not set by the linker.
const FallbackVersion = "dirty"
diff --git a/internal/outcome/dispatcher.go b/internal/outcome/dispatcher.go
index e2feb373..20c70a4b 100644
--- a/internal/outcome/dispatcher.go
+++ b/internal/outcome/dispatcher.go
@@ -14,7 +14,7 @@ import (
"hakurei.app/container/check"
"hakurei.app/container/seccomp"
"hakurei.app/container/std"
- "hakurei.app/internal"
+ "hakurei.app/internal/info"
"hakurei.app/internal/system/dbus"
"hakurei.app/message"
)
@@ -156,7 +156,7 @@ func (direct) seccompLoad(rules []std.NativeRule, flags seccomp.ExportFlag) erro
return seccomp.Load(rules, flags)
}
-func (direct) mustHsuPath() *check.Absolute { return internal.MustHsuPath() }
+func (direct) mustHsuPath() *check.Absolute { return info.MustHsuPath() }
func (direct) dbusAddress() (session, system string) { return dbus.Address() }
diff --git a/internal/outcome/process.go b/internal/outcome/process.go
index 537235fd..e7b7113d 100644
--- a/internal/outcome/process.go
+++ b/internal/outcome/process.go
@@ -16,7 +16,7 @@ import (
"hakurei.app/container/check"
"hakurei.app/container/fhs"
"hakurei.app/hst"
- "hakurei.app/internal"
+ "hakurei.app/internal/info"
"hakurei.app/internal/store"
"hakurei.app/internal/system"
"hakurei.app/message"
@@ -39,7 +39,7 @@ func (k *outcome) main(msg message.Msg, identifierFd int) {
}
// read comp value early for early failure
- hsuPath := internal.MustHsuPath()
+ hsuPath := info.MustHsuPath()
const (
// transitions to processCommit, or processFinal on failure
diff --git a/package.nix b/package.nix
index 16b769e3..b8518a94 100644
--- a/package.nix
+++ b/package.nix
@@ -65,7 +65,7 @@ buildGoModule rec {
lib.attrsets.foldlAttrs
(
ldflags: name: value:
- ldflags ++ [ "-X hakurei.app/internal.${name}=${value}" ]
+ ldflags ++ [ "-X hakurei.app/internal/info.${name}=${value}" ]
)
(
[ "-s -w" ]