aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/outcome/hsu.go
diff options
context:
space:
mode:
authorOphestra <cat@gensokyo.uk>2026-06-08 14:19:11 +0900
committerOphestra <cat@gensokyo.uk>2026-06-08 14:58:24 +0900
commitf869ff95a12756de97827b4afd93763f9661f144 (patch)
tree6f5445ae623f44ceb99c8f7ddb5bb4cd1fb04aa0 /internal/outcome/hsu.go
parent725f2e0ef3eaba1ad46b597604a684125ab93911 (diff)
all: apply modernisers
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/outcome/hsu.go')
-rw-r--r--internal/outcome/hsu.go10
1 files changed, 4 insertions, 6 deletions
diff --git a/internal/outcome/hsu.go b/internal/outcome/hsu.go
index 118fd681..ecb616c0 100644
--- a/internal/outcome/hsu.go
+++ b/internal/outcome/hsu.go
@@ -51,18 +51,16 @@ func (h *Hsu) ID() (int, error) {
cmd.Stderr = os.Stderr // pass through fatal messages
cmd.Env = make([]string, 0)
cmd.Dir = fhs.Root
- var (
- p []byte
- exitError *exec.ExitError
- )
-
+ var p []byte
const step = "obtain uid from hsu"
if p, h.idErr = h.k.cmdOutput(cmd); h.idErr == nil {
h.id, h.idErr = strconv.Atoi(string(p))
if h.idErr != nil {
h.idErr = &hst.AppError{Step: step, Err: h.idErr, Msg: "invalid uid string from hsu"}
}
- } else if errors.As(h.idErr, &exitError) && exitError != nil && exitError.ExitCode() == 1 {
+ } else if exitError, ok := errors.AsType[*exec.ExitError](h.idErr); ok &&
+ exitError != nil &&
+ exitError.ExitCode() == 1 {
// hsu prints an error message in this case
h.idErr = &hst.AppError{Step: step, Err: ErrHsuAccess}
} else if errors.Is(h.idErr, os.ErrNotExist) {