This feels like a 101 question, but I'm still stumped by it. I have the following:
type ITable interface{}
type Table struct{
Ref bigquery.Table
}
type IQuery interface {
SetUploadOptions(table ITable)
}
type Query struct{}
func (s *Query) SetUploadOptions(t Table) {
// Use t.Ref here
}
func New() IQuery {
return &Query{} // Causes InvalidIfaceAssign
}
and get the following:
cannot use &(Query literal) (value of type *Query) as IQuery value in return statement: *Query does not implement IQuery (wrong type for method SetUploadOptions)
have SetUploadOptions(t Table)
want SetUploadOptions(table ITable)compilerInvalidIfaceAssign
AFAIK Table
implements ITable
, though from reading it may be that it actually implements a pointer to ITable
. Either way, I need to use the concrete type Table
in SetUploadOptions
because I need an underlying Ref
property of Table
.
What am I doing wrong?