-
Notifications
You must be signed in to change notification settings - Fork 149
Closed
Labels
Description
ByteStreamConsumer won't write to a destination of type interface{} even if it has a concrete type of []byte
package main
import (
"bytes"
"fmt"
"github.com/go-openapi/runtime"
)
func main() {
src := []byte{0x1, 0x2, 0x3}
bsc := runtime.ByteStreamConsumer()
dst := []byte{}
err := bsc.Consume(bytes.NewBuffer(src), &dst)
if err !=nil {
fmt.Println(err)
}
fmt.Println(dst)
var dst2 interface{} = []byte{}
err = bsc.Consume(bytes.NewBuffer(src), &dst2)
if err !=nil {
fmt.Println(err)
}
fmt.Println(dst2)
}
produces
[1 2 3]
0xc0001ed340 (*interface {}) is not supported by the ByteStreamConsumer, can be resolved by supporting Writer/BinaryUnmarshaler interface
[]
Reactions are currently unavailable