aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/app/spfinal.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2025-10-10 03:19:09 +0900
committerOphestra <cat@gensokyo.uk>2025-10-10 03:19:09 +0900
commit109aaee6593ac6e72d23b817e5b75292c2ed7bed (patch)
tree459fbd8f8c0685b33002fb1f9c101c9b39a38b6a /internal/app/spfinal.go
parent22ee5ae151fa991cf23dbf1b3efb5a0d6fb9b092 (diff)
internal/app: copy parts of config to state
This is less error-prone than passing the address to the entire hst.Config struct, and reduces the likelihood of accidentally clobbering hst.Config. This also improves ease of testing. Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/app/spfinal.go')
-rw-r--r--internal/app/spfinal.go12
1 files changed, 6 insertions, 6 deletions
diff --git a/internal/app/spfinal.go b/internal/app/spfinal.go
index 8760d090..f67d255f 100644
--- a/internal/app/spfinal.go
+++ b/internal/app/spfinal.go
@@ -13,15 +13,15 @@ import (
"hakurei.app/system/acl"
)
-func init() { gob.Register(spFinal{}) }
+func init() { gob.Register(spFinalOp{}) }
-// spFinal is a transitional op destined for removal after #3, #8, #9 has been resolved.
+// spFinalOp is a transitional op destined for removal after #3, #8, #9 has been resolved.
// It exists to avoid reordering the expected entries in test cases.
-type spFinal struct{}
+type spFinalOp struct{}
-func (s spFinal) toSystem(state *outcomeStateSys) error {
+func (s spFinalOp) toSystem(state *outcomeStateSys) error {
// append ExtraPerms last
- for _, p := range state.config.ExtraPerms {
+ for _, p := range state.extraPerms {
if p == nil || p.Path == nil {
continue
}
@@ -45,7 +45,7 @@ func (s spFinal) toSystem(state *outcomeStateSys) error {
return nil
}
-func (s spFinal) toContainer(state *outcomeStateParams) error {
+func (s spFinalOp) toContainer(state *outcomeStateParams) error {
// TODO(ophestra): move this to spFilesystemOp after #8 and #9
// mount root read-only as the final setup Op