[go-nuts] Re: Investigating explosive memory growth with race detector

2023-03-31 Thread Jason E. Aten
ideas to get a profile under duress: a) rent a bigger box with tons of cpu and ram for 15 minutes to get your profile b) terminate the pprof profile programatically after a short amount of time; e.g. f, err := os.Create("my_cpu_profile") panicOn(err) pprof.StartCPUProfile(f) go func() { time.

[go-nuts] Re: Mocking out calls in standard library

2023-03-31 Thread Jason E. Aten
I hasten to add, my library sshego makes it pretty easy to spin up and down an sshd. e.g. https://github.com/glycerine/sshego/blob/master/server_test.go On Friday, March 31, 2023 at 11:20:41 PM UTC-5 Jason E. Aten wrote: > I would just start a server on 127.0.0.1 and have it provide the expecte

[go-nuts] Re: Mocking out calls in standard library

2023-03-31 Thread Jason E. Aten
I would just start a server on 127.0.0.1 and have it provide the expected responses. This is simple and straightforward, and gives a much better test; end-to-end. The less mocking the better from my point of view. If you have to, you would simply wrap the existing structs, creating a higher l

[go-nuts] Re: Calling panic() is corrupting system stack

2023-03-31 Thread mariappan balraj
Hello Go experts, Could someone please help to resolve this issue? Best Regards Mariappan On Thu, Mar 30, 2023 at 2:52 PM mariappan balraj wrote: > Hello Go Experts, > > When panic() is called from Go function, in the below call sequence, > runtime.unwindm() [which is defer function of runtim

Re: [go-nuts] getting the size of an io.ReaderAt?

2023-03-31 Thread Bruno Albuquerque
Not a direct answer to your question (your code looks like a reasonable implementation modulo any bugs I did not notice) but: Aren't you over engineering things? If the source is a PDF file, why not also pass the size to the function instead of doing all this work to get it? At some point you have

[go-nuts] getting the size of an io.ReaderAt?

2023-03-31 Thread Jochen Voss
Dear all, I am trying to get the size of an io.ReaderAt, i.e. the offset after which no more data can be read. I have some working (?) code (https://go.dev/play/p/wTouYbaJ7RG , also reproduced below), but I am not sure whether what I do is correct and the best way to do this. Some questions:

[go-nuts] Mocking out calls in standard library

2023-03-31 Thread Inian Vasanth
Hello Community, I'm testing out some code for increasing code coverage of our repository, i.e. to maximum level possible. One of the methods I'm dealing with are few methods in standard library (ssh, sftp) that need to be modified for custom behavior. See Goplay snippet here - https://go.dev/