Skip to content

Commit 1ff9f8c

Browse files
committed
fix(lockfile): ensure single trailing newline in unirtm.lock to satisfy pre-commit end-of-file-fixer
1 parent f1d5b1c commit 1ff9f8c

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

internal/lockfile/lockfile.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,13 @@ func (lf *LockFile) Save() error {
210210
}
211211
}
212212

213+
// Ensure exactly one trailing newline
214+
out := bytes.TrimRight(buf.Bytes(), "\n")
215+
out = append(out, '\n')
216+
213217
// Atomic write: temp file → rename.
214218
tmp := lf.path + ".tmp"
215-
if err := os.WriteFile(tmp, buf.Bytes(), 0644); err != nil {
219+
if err := os.WriteFile(tmp, out, 0644); err != nil {
216220
return fmt.Errorf("lockfile: write temp: %w", err)
217221
}
218222
if err := os.Rename(tmp, lf.path); err != nil {

0 commit comments

Comments
 (0)