I think what the OP wants is:
type A interface{}
type B interface{}
...
PrintInterface(A)
Meaning they want to pass the interface definition to some method.
At least that’s what I am guessing.
> On Dec 9, 2018, at 9:22 PM, Space A. wrote:
>
> reflect/* is a bit tricky. Use pointer to get
reflect/* is a bit tricky. Use pointer to get interface itself.
package main
import (
"fmt"
"reflect"
)
func main() {
test := interface{}("test")
printInterfaceValue(test)
}
func printInterfaceValue(i interface{}) {
switch testing := i.(type) {
case interface{}:
I know this is an old question but it hasn't changed and I believe this was
for compatibility with RFC 2109 (which is obsoleted by RFC 6265).
Section 4.2.2 states:
Domain=domain
Optional. The Domain attribute specifies the domain for which the
cookie is valid. An explicitly
I mean reflect.Type not a type that is an interface.
> On Dec 9, 2018, at 6:53 PM, Space A. wrote:
>
> Of course. When you "pass a value whose type implements the interface" as an
> interface argument to a function, you in fact pass an interface.
>
>
> воскресенье, 9 декабря 2018 г.,
Of course. When you "pass a value whose type implements the interface" as
an interface argument to a function, you in fact pass an *interface*.
воскресенье, 9 декабря 2018 г., 23:23:41 UTC+3 пользователь Mark Volkmann
написал:
>
> Is it possible to pass an interface to a function in Go? I
If you want the interface to be interpreted as an interface value and
your parameter type is interface{}, you can pass a pointer to the
interface value and then work with that.
On Sun, 2018-12-09 at 14:23 -0600, Mark Volkmann wrote:
> Is it possible to pass an interface to a function in Go? I
Just declare the parameter as type Type and then in the method check if it is
an interface.
The caller uses the interface type.
> On Dec 9, 2018, at 2:43 PM, Jan Mercl <0xj...@gmail.com> wrote:
>
> On Sun, Dec 9, 2018 at 9:23 PM Mark Volkmann
> wrote:
>
> > Is it possible to pass an
On Sun, Dec 9, 2018 at 9:23 PM Mark Volkmann
wrote:
> Is it possible to pass an interface to a function in Go? I don’t want to
pass a value whose type implements the interface, I want to pass the
interface.
I think the question is not clear enough. Could you please provide an
example of what
Is it possible to pass an interface to a function in Go? I don’t want to
pass a value whose type implements the interface, I want to pass the
interface.
--
R. Mark Volkmann
Object Computing, Inc.
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
This is how I do it (and go/src/cmd/compile/internal/gc) , but I still get
errors "expected operand" .
I would like a little more details from those who have already done this.
воскресенье, 9 декабря 2018 г., 19:48:58 UTC+3 пользователь Aram Hăvărneanu
написал:
>
> Start with
In fmt.Println function, \n is used. Is \n safe to use in different
platforms?
--
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
Start with go/src/cmd/compile/internal/syntax and go from there.
--
Aram Hăvărneanu
--
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
What do you mean by "-wgr"
воскресенье, 9 декабря 2018 г., 18:31:11 UTC+3 пользователь Wagner Riffel
написал:
>
> define operator.
> -wgr
>
> On Sun, Dec 9, 2018, 10:27 AM Claygod >
> wrote:
>
>> Hello,
>>
>> I want to try adding a new operator. Tell me, in which packages you need
>> to edit
define operator.
-wgr
On Sun, Dec 9, 2018, 10:27 AM Claygod wrote:
> Hello,
>
> I want to try adding a new operator. Tell me, in which packages you need
> to edit the code?
> Maybe once a similar question was discussed, then please give a link
>
> --
> You received this message because you are
[0]
--
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.
Thanks, C.GoBytes Works well.
Another question. How to convert []byte to *byte backward?
Ian Lance Taylor 于2018年12月3日周一 下午1:01写道:
> On Sat, Dec 1, 2018 at 9:39 AM wrote:
> >
> > I am using swig wrap a c++ module , the generated go code is like this:
> >
> > type MediaFrame
Hello,
I want to try adding a new operator. Tell me, in which packages you need to
edit the code?
Maybe once a similar question was discussed, then please give a link
--
You received this message because you are subscribed to the Google Groups
"golang-nuts" group.
To unsubscribe from this
17 matches
Mail list logo