Skip to content

Commit

Permalink
Add TinyGo support; Add Cloudflare Workers rendezvous server example
Browse files Browse the repository at this point in the history
Requires the TinyGo fork found at https://github.com/ben-krieger/tinygo/tree/reflect-clear-and-more

Signed-off-by: Ben Krieger <[email protected]>
  • Loading branch information
ben-krieger committed Oct 29, 2024
1 parent 1fef581 commit a3928a8
Show file tree
Hide file tree
Showing 16 changed files with 805 additions and 219 deletions.
9 changes: 2 additions & 7 deletions cbor/cbor.go
Original file line number Diff line number Diff line change
Expand Up @@ -1243,15 +1243,10 @@ func (e *Encoder) encodeTextOrBinary(rv reflect.Value) error {

// Unaddressable arrays cannot be made into slices, so we must create a
// slice and copy contents into it
slice := reflect.MakeSlice(
reflect.SliceOf(rv.Type().Elem()),
rv.Len(),
rv.Len(),
)
if n := reflect.Copy(slice, rv); n != rv.Len() {
b = make([]byte, rv.Len())
if n := reflect.Copy(reflect.ValueOf(b), rv); n != rv.Len() {
panic("array contents were not fully copied into a slice for encoding")
}
b = slice.Bytes()
}

info := u64Bytes(uint64(len(b)))
Expand Down
Loading

0 comments on commit a3928a8

Please sign in to comment.