[go-nuts] Dlopen without Cgo on Darwin (#18296)

2019-12-12 Thread 'Ivan Trubach' via golang-nuts
Hi, I’ve stubbled upon issue 18296 (dlopen/dlsym without CGo). The discussion focuses on Linux, but since Go on Darwin already co-exists with libSystem, wouldn’t it be trivial to add Darwin dlopen support to e.g. x/sys/unix? I’ve also set up a small standalone dlopen demo:

Re: [go-nuts] How to have fixed xml attributes "Header"

2019-12-12 Thread paresh patil
Thanks a lot Marcin, it worked The code is working as expected and I can generate the xml file from csv. Now my next challenges are: 1. How to have fixed values in the xml file, ** * 3.4* * * * 1* * 2019-11-04 18:11 - Is there a way in Go to returns current time stamp? so we get the date

Re: [go-nuts] How to mock structs with interdependent interface methods?

2019-12-12 Thread Marcin Romaszewicz
I face similar problems in a lot of production Go code which I write. I do have an answer for this, but it's not pretty. Your code would look something like this: type ResourceGetter interface { GetResource(id string) (*Resource, error) } type ResourceManagerImpl struct { rg ResourceGetter

[go-nuts] How to mock structs with interdependent interface methods?

2019-12-12 Thread karthik3186
I am having trouble writing unit tests in Go for a rather common use-case/pattern. Imagine, if you will, something like this: package main type Resource struct { name string} type ResourceManager interface { GetResource(id string) (*Resource, error) GetAllResources()

Re: [go-nuts] How to have fixed xml attributes "Header"

2019-12-12 Thread Marcin Romaszewicz
Your code creates an array for manifests ([]Manifest), and puts one entry in there for each package, so encoding/xml is dutifully doing what you asked it to do :) You need to change your object structure so that you have one manifest with a single header, and a list of packages. Something like

Re: [go-nuts] How to have fixed xml attributes "Header"

2019-12-12 Thread paresh patil
Hi Marcin, Thanks for writing back I will sure try your code I'm attaching the zip folder which has the complete code. It needs some corrections as well, Let me know your thoughts Thanks On Thu, Dec 12, 2019 at 6:14 PM Marcin Romaszewicz wrote: > Could you share your code which isn't

Re: [go-nuts] How to have fixed xml attributes "Header"

2019-12-12 Thread Marcin Romaszewicz
Could you share your code which isn't working? Here's a simple example of how you would do something like that, but not knowing your code, it might not be helpful. https://play.golang.org/p/H-9eCTYJxTA On Thu, Dec 12, 2019 at 9:57 AM paresh patil wrote: > Hi, > > > I'm new to Go and finding

[go-nuts] How to have fixed xml attributes "Header"

2019-12-12 Thread paresh patil
Hi, I'm new to Go and finding it interesting to learn. I'm not a developer or programmer, but I have interest in learning to code I'm working on a project to convert csv file to xml file. The code executes and I'm able to generate a xml file. But the file is not in the expected format. I

Re: [go-nuts] Help with Go channels and select talk

2019-12-12 Thread 'Bryan C. Mills' via golang-nuts
On Thu, Dec 12, 2019 at 1:17 AM Egon Kocjan wrote: > My demo is based on a real problem in our code. The issue here is that I > cannot paste proprietary code and it's large and complex anyway. I > distilled the problem to a bidi-communication coding exercise. The "go srv" > in the real code is

Re: [go-nuts] Re: help with reflect

2019-12-12 Thread Vasiliy Tolstov
вт, 10 дек. 2019 г. в 00:49, Dan Kortschak : > > On Mon, 2019-12-09 at 14:57 +0300, Vasiliy Tolstov wrote: > > Nevermind. I found the error > > https://paulcunningham.me/nevermind-found-answer/ > Ok, sorry, i'm try to provide answer for next time =) -- Vasiliy Tolstov, e-mail:

Re: [go-nuts] [long STW] I have a problem with STW, which PauseNs max > 4s

2019-12-12 Thread kcn test
Thank you for your help! Wojciech S. Czarnecki 于2019年12月12日周四 下午4:30写道: > On Wed, 11 Dec 2019 00:20:16 -0800 (PST) > kcn wrote: > > > go version = 1.9 > This Go version is no longer supported. That's why you did not get other > answers yet. > > > I know golang's STW is very efficient,but I

Re: [go-nuts] [long STW] I have a problem with STW, which PauseNs max > 4s

2019-12-12 Thread Wojciech S. Czarnecki
On Wed, 11 Dec 2019 00:20:16 -0800 (PST) kcn wrote: > go version = 1.9 This Go version is no longer supported. That's why you did not get other answers yet. > I know golang's STW is very efficient,but I don't know what happens about > this, > when I restart the program, everything returns