diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2023-02-26 09:37:30 +0000 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2023-02-26 09:37:30 +0000 |
commit | 7b63b7c9d03b23f496ec9bfb8e91be3693b19a8f (patch) | |
tree | 824aa1c659e532537f812be36d0e0384eae1b2fd /walk | |
parent | 9ba3b1d97e8fd2a2e3c4bb08fe350c8dd5f9733e (diff) | |
download | stred-go-7b63b7c9d03b23f496ec9bfb8e91be3693b19a8f.tar |
Replace append with walk.ConcatData in many places to fix bug to do with semantics of append
When doing append, be very careful as it does make changes in place to the underlying array of the slice which may affect other slices
Diffstat (limited to 'walk')
-rw-r--r-- | walk/walk.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/walk/walk.go b/walk/walk.go index 30bfb29..a9b40b7 100644 --- a/walk/walk.go +++ b/walk/walk.go @@ -373,3 +373,7 @@ func JsonOut(in chan WalkItem) { } fmt.Print("\n") } + +func ConcatData(first []Datum, second []Datum) []Datum { + return append(append([]Datum(nil), first...), second...) +} |