I have code like this:
type TestCase struct {
Name        string
Description string
OrderOp     [][]Operation
}

type Concurrent []Operation
type Sequential []Operation

With the intent to do things like this:
OrderOp: [][]Operation{
Concurrent{
{ID: "A", Name: "Read", ArgumentType: "ReadRequest", Value: ""},
{ID: "B", Name: "Write", ArgumentType: "Value", Value: "7"},
},
Sequential{
{ID: "C", Name: "Read", ArgumentType: "ReadRequest", Value: ""},
{ID: "D", Name: "Write", ArgumentType: "Value", Value: "8"},
},
}

However, it seems that the OrderOp array do not preserve the type 
information, and I cannot use type assertion or reflect.TypeOf() to recover 
the types Concurrent and Sequential, that I intended to. For a full 
example, see link below.

My question is: How can I best work around this problem??

(Preferably without adding a separate field in a struct to discriminate 
between concurrent and sequential.)

https://github.com/selabhvl/cpnmbt/blob/master/rwregister/table_test.go

Thanks,
:) Hein

-- 
You received this message because you are subscribed to the Google Groups 
"golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to golang-nuts+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to