Re: [go-nuts] Re: How to generate generic code with generate?

2017-01-23 Thread Konstantin Khomoutov
On Mon, 23 Jan 2017 21:39:39 -0800 (PST) hui zhang wrote: > > With github.com/badgerodon/goreify you can do this: > As this github auther says: > I found gengen after implementing > most of this functionality. It follows a similar approach, though > doesn't tak

[go-nuts] Re: How to generate generic code with generate?

2017-01-23 Thread hui zhang
As this github auther says: I found gengen after implementing most of this functionality. It follows a similar approach, though doesn't take it quite as far. gengen seems better according to github star. I wonder if there are any better packages out there , h

Re: [go-nuts] How to use []interface{} in generic programing

2017-01-23 Thread Justin Israel
In past answers to similar questions, I have seen the stated answers being that []Fight and []IReset are not the same type, and there is no support for automatically converting from one to the other, and it will not treat the slice of concrete types as the slice of IReset interfaces because of a di

Re: [go-nuts] Re: How to make an anonymous recursive function?

2017-01-23 Thread Frank Solomon
This approach makes "nested" recursion possible: https://github.com/fbsolo/ProjectEuler/blob/master/main.go - Frank On Friday, April 25, 2014 at 7:24:28 AM UTC-7, emepyc wrote: > > Yes, but you should return the result ;-) > > http://play.golang.org/p/h-VYDrY7Ov > > M; > > On 25/04/14 14:41,

[go-nuts] How to use []interface{} in generic programing

2017-01-23 Thread hui zhang
check code below, How to use []interface{} in generic programing? type IReset interface { Reset() } type Fight struct { hp,mp int } func (my *Fight) Reset () { my.hp = 0 my.mp = 0 } func reset1(x IReset){ x.Reset() } func reset(x []IReset) { for i := range x { x[i].Reset()

[go-nuts] net/rpc result types

2017-01-23 Thread Pablo Rozas Larraondo
Hi, The rpc documentation says that a remote rpc method can be registered if the second argument (response) is a pointer. https://golang.org/pkg/net/rpc/#Server.Register Does anyone know if there is a way of having an interface declared as this response type and then assign pointers to it that s

[go-nuts] Results of the 2016 Go User Survey?

2017-01-23 Thread faiface2202
Hi, what is the state of 2016 Go User Survey? Are the results ever gonna be available? Or are they already and I've just missed them? Thanks, Michal Štrba -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

Re: [go-nuts] Why is passing a pointer to a pointer in cgo dissalowed?

2017-01-23 Thread Ian Lance Taylor
On Mon, Jan 23, 2017 at 3:57 AM, wrote: > The doc for cgo states ... > > "Go code may pass a Go pointer to C provided the Go memory to which it > points does not contain any Go pointers. The C code must preserve this > property: it must not store any Go pointers in Go memory, even temporarily. >

Re: [go-nuts] Foregrounding, process management, os/exec.Cmd

2017-01-23 Thread James Aguilar
On Sun, Jan 22, 2017 at 8:45 PM Ian Lance Taylor wrote: > On Sat, Jan 21, 2017 at 4:07 PM, James Aguilar > wrote: > > If you don't know or care about pagers and process management, you can > stop > > reading now. > > > > Background: I have a program that compile my code each time I modify it. >

[go-nuts] How to dllexport a value symbol within a windows binary executable with Go?

2017-01-23 Thread Hakan Guleryuz
In normal C/C++ SDL2 related app I write, adding the following code extern "C" { _declspec(dllexport) DWORD NvOptimusEnablement = 0x0001; } causes the driver system with integrated and dedicated nvidia gpu, to auto select the dedicated nvidia gpu. See here for some explanation of the me

[go-nuts] Why is passing a pointer to a pointer in cgo dissalowed?

2017-01-23 Thread pierspowlesland
The doc for cgo states ... "Go code may pass a Go pointer to C provided the Go memory to which it points does not contain any Go pointers. The C code must preserve this property: it must not store any Go pointers in Go memory, even temporarily. When passing a pointer to a field in a struct, the

Re: [go-nuts] cross-compilation for go-gl applications

2017-01-23 Thread Aram Hăvărneanu
Those packages use cgo, so you will need a gcc-based toolchain for your target platform. Either you will have to build it yourself (doing that on Windows is probably challenging), or perhaps you can find a prebuilt gcc (good luck with that). Make sure to install the relevant OpenGL headers and libr

[go-nuts] Re: How to generate generic code with generate?

2017-01-23 Thread Caleb Doxsey
Hi, With github.com/badgerodon/goreify you can do this: //go:generate goreify examples/min.Min numeric // Min finds the minimum value in a slice func Min(args ...generics.T1) (r generics.T1) { if len(args) == 0 { panic("the minimum of nothing is undefined") } r = args[0] for i := 1; i < len(arg

[go-nuts] Question about parallel tests

2017-01-23 Thread Diego Bernardes
If a test is marked as parallel, does the sub tests run in parallel too? Or should i mark then as parallel? -- 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 golan

Re: [go-nuts] Foregrounding, process management, os/exec.Cmd

2017-01-23 Thread Peter Waller
I'm afraid I can't find the code, but I actually did this in the distant past and recall having some success. (I was the one who introduced Ctty to SysProcAttr for this very purpose! :). One thing it seems as though you're missing is you don't set SysProcAttr.Setctty. The documentation string for

[go-nuts] Re: [ANN] template-compiler: compile go templates to go code

2017-01-23 Thread Egon
Awesome :) On Saturday, 21 January 2017 16:58:53 UTC+2, mhh...@gmail.com wrote: > > Hi, > > I have been working on a package to compile go templates to regular go > code. > Today i can announce an early release of it. > > Find it here > https://github.com/mh-cbon/template-compiler > > There is s