Re: [go-nuts] Re: pass interface

2018-12-09 Thread Robert Engels
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

Re: [go-nuts] Re: pass interface

2018-12-09 Thread Space A.
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{}:

Re: [go-nuts] net/http why drop the leading dot of cookie.Domain

2018-12-09 Thread marawan31
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

Re: [go-nuts] Re: pass interface

2018-12-09 Thread Robert Engels
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 г.,

[go-nuts] Re: pass interface

2018-12-09 Thread Space A.
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

Re: [SUSPECTED SPAM][go-nuts] pass interface

2018-12-09 Thread Dan Kortschak
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

Re: [go-nuts] pass interface

2018-12-09 Thread Robert Engels
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

Re: [go-nuts] pass interface

2018-12-09 Thread Jan Mercl
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

[go-nuts] pass interface

2018-12-09 Thread Mark Volkmann
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.

Re: [go-nuts] How to add a new operator

2018-12-09 Thread Claygod
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

[go-nuts] \n new line feed

2018-12-09 Thread 伊藤和也
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

Re: [go-nuts] How to add a new operator

2018-12-09 Thread Aram Hăvărneanu
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

Re: [go-nuts] How to add a new operator

2018-12-09 Thread Claygod
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

Re: [go-nuts] How to add a new operator

2018-12-09 Thread 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 the code? > Maybe once a similar question was discussed, then please give a link > > -- > You received this message because you are

Re: [go-nuts] convert *byte to []byte

2018-12-09 Thread Tamás Gulácsi
[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.

Re: [go-nuts] convert *byte to []byte

2018-12-09 Thread xiang liu
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

[go-nuts] How to add a new operator

2018-12-09 Thread Claygod
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