fix(y): shall always return empty slice rather than nil (#2245)

Fixes #2067

**Description**

This PR fixes an issue where Go's `append` returns `nil` when appending
an empty slice to a nil slice.
I added a check in `SafeCopy` to ensure we always return `[]byte{}` in
this case, along with a new unit test.
I also verified it using the test offered in the issue

**Checklist**

- [x] Code compiles correctly and linting passes locally
- [ ] For all _code_ changes, an entry added to the `CHANGELOG.md` file
describing and linking to
      this PR
- [x] Tests added for new functionality, or regression tests for bug
fixes added as applicable

---------

Co-authored-by: Matthew McNeely <matthew.mcneely@gmail.com>
This commit is contained in:
kooltuoehias
2025-12-15 16:56:42 -05:00
committed by GitHub
co-authored by Matthew McNeely
parent 2b4ec9d4a8
commit 90ebc7e33d
4 changed files with 56 additions and 8 deletions
+2 -2
View File
@@ -106,6 +106,6 @@ write_coverage() {
# parallel tests currently not working
# parallel --halt now,fail=1 --progress --line-buffer ::: stream manual root
# run tests in sequence
#root
#stream
root
stream
manual