diff options
| author | Fuwn <[email protected]> | 2026-02-26 20:20:17 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-02-26 20:20:17 -0800 |
| commit | e264ed8f36b26c5684ea653ad7299603ccffe02b (patch) | |
| tree | 95bbb4ad51740d7bcc0d834bd1aaa587df22f233 /cmd/plutia/keygen.go | |
| parent | fix: align PLC compatibility read endpoints with plc.directory schema (diff) | |
| download | plutia-test-e264ed8f36b26c5684ea653ad7299603ccffe02b.tar.xz plutia-test-e264ed8f36b26c5684ea653ad7299603ccffe02b.zip | |
feat: Apply Iku formatting
Diffstat (limited to 'cmd/plutia/keygen.go')
| -rw-r--r-- | cmd/plutia/keygen.go | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/cmd/plutia/keygen.go b/cmd/plutia/keygen.go index f2f5820..2828f60 100644 --- a/cmd/plutia/keygen.go +++ b/cmd/plutia/keygen.go @@ -27,6 +27,7 @@ func runKeygen(args []string) error { } fingerprint, err := writeMirrorPrivateKey(*out, *force, rand.Reader) + if err != nil { return err } @@ -70,16 +71,19 @@ func writeAtomicFile(path string, data []byte, force bool, mode os.FileMode) err } tmp, err := os.CreateTemp(dir, ".plutia-keygen-*") + if err != nil { return fmt.Errorf("create temp key file: %w", err) } tmpPath := tmp.Name() closed := false + defer func() { if !closed { _ = tmp.Close() } + _ = os.Remove(tmpPath) }() @@ -98,6 +102,7 @@ func writeAtomicFile(path string, data []byte, force bool, mode os.FileMode) err if err := tmp.Close(); err != nil { return fmt.Errorf("close temp key file: %w", err) } + closed = true if force { |