Re: [go-nuts] Can't figure out why simple mockserver doesn't hit the handler

2025-03-14 Thread Lin Lin
Hi, David, I'm no expert on http std. But the following testcase based on the httptest unittest code works. I think the key point is to use ' client.Get(server.URL)' to invoke a request. Hope it helps. import "testing" import "os" import "net/http" import "net/http/httptest" func TestProcessProj

[go-nuts] Re: Can't figure out why simple mockserver doesn't hit the handler

2025-03-14 Thread Jason E. Aten
Typically http servers start a goroutine per client. If your mock server is doing that (without seeing the code, we cannot tell), a debugger won't step between the client and server goroutines. Put print statements in to tell what is actually happening. I have a little library I use constantly

[go-nuts] Can't figure out why simple mockserver doesn't hit the handler

2025-03-14 Thread David Karr
A little while ago, I was able to write some unit tests for some code that makes an http connection. I created a mockserver and a client using that server. That test in that application works fine. I'm now trying to do basically the same thing in a different application. I'm trying to start wi

Re: [go-nuts] sharded rw mutex approaches?

2025-03-14 Thread Jason E. Aten
An update... I discovered that the CPUID instruction, despite its name, is the exactly wrong way to get the cpu ID. It is for reading features, not processor identity, and it completely serializes everything, flushes your CPU pipeline, does a memory fence, and makes rude noises to your grandma's

Re: [go-nuts] sharded rw mutex approaches?

2025-03-14 Thread Jason E. Aten
I do keep seeing references to Java concurrent stuff people are porting to Go. I have to check it out. I need an ordered k/v store (find the next key greater-than)... and I was trying to see how concurrency could be added to things like https://github.com/google/btree, which, in turns out, at l

Re: [go-nuts] sharded rw mutex approaches?

2025-03-14 Thread Robert Engels
You can look at things like concurrent skip lists and for large data sets with persistence, log sequential merge trees. On Mar 14, 2025, at 1:20 AM, Jason E. Aten wrote:(If that seems surprising, the reason is mentioned in the sibling c++ library announcement:"performance in these cases is effect

[go-nuts] Pipe operations library

2025-03-14 Thread Nikita Loskutov
Hello! I'm writing a library to simplify and optimize operations with files (everything is a file): https://github.com/cnaize/pipe Example: func main() { // create a pipeline pipeline := pipes.Line( // set execution timeout common.Timeout(time.Second), // open two example files localfs.OpenFil