Skip to content

Commit 8d7d6ca

Browse files
authored
[CLI] Added a "\n" to end of writefile (#1251)
## Summary Added '\n' to end of `WriteFile()` in `cuecfg` package. This resolves an issue of devbox.json unnecessarily showing up in PR diffs because the newline at the end of the file is removed by CLI and was added by IDE formatters. However, this function is used to write the config to a file as well as a couple of other cases such as in `auth` package. I'm guessing the `\n` for cases other than writing config won't cause an issue. But I haven't tested those cases. Addresses #1248 ## How was it tested? - compile - `./devbox init` has a newline at the end of devbox.json and devbox.lock - `./devbox add hello` keeps the newline at the end of devbox.json and devbox.lock
1 parent da872a0 commit 8d7d6ca

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

internal/cuecfg/cuecfg.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ func WriteFile(path string, value any) error {
8282
if err != nil {
8383
return errors.WithStack(err)
8484
}
85-
85+
data = append(data, '\n')
8686
return errors.WithStack(os.WriteFile(path, data, 0644))
8787
}
8888

0 commit comments

Comments
 (0)