Re: [go-nuts] find module of dependent package

2019-12-23 Thread Dan Kortschak
Solved thanks to Daniel Martí; use `go list -json` and grab the Module struct out of that. On Tue, 2019-12-24 at 09:50 +1030, Dan Kortschak wrote: > Say I have a package path, "host.org/user/depmodule/pkgdep", which is > the path to a dependency of "host.org/user/repomain/pkgmain". The > go.mod

[go-nuts] find module of dependent package

2019-12-23 Thread Dan Kortschak
Say I have a package path, "host.org/user/depmodule/pkgdep", which is the path to a dependency of "host.org/user/repomain/pkgmain". The go.mod file in host.org/user/repomain will have a line "host.org/user/depmodule" in the require block. If I want to programmatically find what the module path is

Re: [go-nuts] playground behaves different from local machine

2019-12-23 Thread T L
Looks the multiple trick is not a theory. That is cool! I don't know if this is an issue known for a long time. If it is not, I would file an issue some time later. On Mon, Dec 23, 2019 at 1:04 PM Axel Wagner wrote: > Sorry for the off-list response, that was unintentional. > > I think it

Re: [go-nuts] Assigning a value to a function pointer

2019-12-23 Thread 'Axel Wagner' via golang-nuts
If what you want is a) assume that a `func()` is pointer-shaped and b) treat it as an unsafe.Pointer for use with atomics, then that's a problem that - as all problems in computer science - can be solved with another layer of indirection: https://play.golang.org/p/o0DvCxPTG1O As Jan mentioned, a

Re: [go-nuts] playground behaves different from local machine

2019-12-23 Thread 'Axel Wagner' via golang-nuts
Sorry for the off-list response, that was unintentional. I think it might be okay, but I could also think of a couple of reasons against it. AFAIK, Go programs for the playground are compiled with a patched stdlib (at least they used to be, to do the faketime-stuff. I don't know if we're already

Re: [go-nuts] Assigning a value to a function pointer

2019-12-23 Thread Jan Mercl
On Mon, Dec 23, 2019 at 6:41 PM wrote: >> > But I cannot find any way of assigning a value to the function pointer `f` >> > even using the `unsafe` package. >> >> https://play.golang.org/p/qP5kuSCW6dO > > Thanks, unfortunately the asm shows that what gets into `f` is the stack > address of

Re: [go-nuts] Assigning a value to a function pointer

2019-12-23 Thread julio
> > But I cannot find any way of assigning a value to the function pointer > `f` even using the `unsafe` package. > > https://play.golang.org/p/qP5kuSCW6dO > Thanks, unfortunately the asm shows that what gets into `f` is the stack address of `f0` and not the address of the function: LEAQ

[go-nuts] Storing test cases in array of struct vs slice of struct

2019-12-23 Thread Rodolfo Carvalho
This is a question about organizing table tests. I believe the most common idiom for writing table tests is to store test cases in a slice of structs like in the example from https://github.com/golang/go/wiki/TableDrivenTests

Re: [go-nuts] playground behaves different from local machine

2019-12-23 Thread T L
;(, looks the last comment doesn't appear in go-nuts. On Mon, Dec 23, 2019 at 9:37 AM T L wrote: > > > However, the playground has no GOROOT or build cache or anything > available: https://play.golang.org/p/RPGwtZSJSPQ > > But, isn't it ok to let the playground own a GOROOT? > > On Mon, Dec 23,

[go-nuts] Re: playground behaves different from local machine

2019-12-23 Thread T L
> by Axel Wagner: > However, the playground has no GOROOT or build cache or anything available: https://play.golang.org/p/RPGwtZSJSPQ But, isn't it ok to let the playground own a GOROOT? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] playground behaves different from local machine

2019-12-23 Thread T L
> However, the playground has no GOROOT or build cache or anything available: https://play.golang.org/p/RPGwtZSJSPQ But, isn't it ok to let the playground own a GOROOT? On Mon, Dec 23, 2019 at 5:47 AM Axel Wagner wrote: > Parsing is not the problem, type-checking is. For that, the >

Re: [go-nuts] Assigning a value to a function pointer

2019-12-23 Thread Jan Mercl
On Mon, Dec 23, 2019 at 2:49 PM wrote: > But I cannot find any way of assigning a value to the function pointer `f` > even using the `unsafe` package. https://play.golang.org/p/qP5kuSCW6dO Note that while you can a pointer to a function, you rarely need that. Function is just a value like int

[go-nuts] Assigning a value to a function pointer

2019-12-23 Thread julio
Hello, The following Go program has a valid syntax: https://play.golang.org/p/V7bIGnTu1fb But I cannot find any way of assigning a value to the function pointer `f` even using the `unsafe` package. My main reason for willing this is to be able to: - atomically load a dynamic address. - avoid

Re: [go-nuts] What happens to completely useless effectless conditions at compile-time?

2019-12-23 Thread Michel Levieux
Hi Ian, Yes, sorry I forgot to specify I was using the standard go compiler. Thank you for your answer! Le sam. 21 déc. 2019 à 07:49, Ian Lance Taylor a écrit : > On Fri, Dec 20, 2019 at 5:07 PM Michel Levieux > wrote: > > > > I was working on a project and for simplicity reasons I just

Re: [go-nuts] [CGO] | Calling C structs(easyhook.h) worked but functions (easyhook.h) not worked.

2019-12-23 Thread Ahmet Tarık GUNAL
I made the same mistake as this link --> https://stackoverflow.com/q/48845724/12569565 Yes this is relevant. I thought you'd look under the Ldflags. So I made weird and ignored it. It worked when I placed the DLLs in the main directory. Thank you so much. 23 Aralık 2019 Pazartesi 08:49:50