Skip to content

Commit 79fca40

Browse files
committed
fix sliceheader use
1 parent 098ea3f commit 79fca40

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

launcher/main.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -110,11 +110,9 @@ func str2slice(s string) (b []byte) {
110110
// TODO: when we bump to go1.20 use unsafe.StringData and unsafe.Slice instead.
111111
shdr := (*reflect.StringHeader)(unsafe.Pointer(&s))
112112
bhdr := (*reflect.SliceHeader)(unsafe.Pointer(&b))
113-
*bhdr = reflect.SliceHeader{
114-
Data: shdr.Data,
115-
Len: shdr.Len,
116-
Cap: shdr.Len,
117-
}
113+
bhdr.Data = shdr.Data
114+
bhdr.Len = shdr.Len
115+
bhdr.Cap = shdr.Len
118116
runtime.KeepAlive(s)
119117
return
120118
}

0 commit comments

Comments
 (0)