[go-nuts] Re: crypto/tls/generate_cert.go: Should it be used? And how can it be used?

2020-11-29 Thread b.ca...@pobox.com
On Sunday, 29 November 2020 at 21:09:24 UTC Jeroen N. Witmond wrote: > go run `locate generate_cert.go` --host 127.0.0.1 --rsa-bits=2048 --ca > > That will only work if there's exactly one instance of generate_cert.go on your filesystem. A better command is: go run "$(go env

Re: [go-nuts] Trying to understand HTTP connection pooling behaviour - new DNS lookup

2020-11-28 Thread b.ca...@pobox.com
> My actual query was to learn how the removal of the broken connection is done. Ah OK. I'm not familiar with this code (net/http/transport.go), and you've already shown that the PutIdleConn trace action isn't called. Maybe this comment is helpful: if

Re: [go-nuts] Trying to understand HTTP connection pooling behaviour - new DNS lookup

2020-11-28 Thread b.ca...@pobox.com
Unless you timestamp those log lines, I don't see any evidence that the DNS query is done when the godoc server shuts down. Could it not just be that after the 2 second sleep, when it's time to make a new connection, it finds that the pool is empty so has to do a lookup to establish a new

[go-nuts] Re: Trying to understand HTTP connection pooling behaviour - new DNS lookup

2020-11-28 Thread b.ca...@pobox.com
Do you see a forward or reverse DNS lookup being made? Can you provide a standalone program which demonstrates this behaviour? I am wondering if either (a) something is logging when the connection is terminated, or (b) a new connection is automatically being made and put into a pool. On

[go-nuts] Re: Give the zero time value a location, and it won't survive a roundtrip to JSON?

2020-11-28 Thread b.ca...@pobox.com
I didn't think that AD was a thing, even though RFC 3339 says it is. Wikipedia says that dates in Common Era and Dionysius BC/AD are equivalent, and that 1BC led straight onto 1AD. -- You received

Re: [go-nuts] How to detect HTTP client stop polling at the server side

2020-11-27 Thread b.ca...@pobox.com
I should add: using channels often means the mutex is not required. Imagine, for example, that you want a concurrency-safe counter (that multiple goroutines can read, increment and decrement). You can put the counter value into a buffered channel: counter := make(chan int, 1) counter <- 0

Re: [go-nuts] concurrency safety

2020-11-27 Thread b.ca...@pobox.com
On Friday, 27 November 2020 at 10:32:11 UTC oyvin...@teigfam.net wrote: > Thread safety, concurrency safety, goroutines safety. The same stuff to > me. > > It's important that concurrent goroutines don't interfere with each other > in such a way that internal state is compromised by other

Re: [go-nuts] How to detect HTTP client stop polling at the server side

2020-11-27 Thread b.ca...@pobox.com
On Friday, 27 November 2020 at 06:14:48 UTC Afriyie Abraham Kwabena wrote: > What I would like to ask is, using mutex OK and if not the best way of > solving it, how can i use > channels in this case. > There's nothing wrong with mutex, but you can use channels for a more native-Go experience.

[go-nuts] Re: Carting int to bool and the reverse for bit hacking ?

2020-11-21 Thread b.ca...@pobox.com
That's fantastic. Paste in int Test0(int v, int v1, int v2, int v3) { return v == v1 || v == v2 || v == v3; } and then the the compiler options to -O3. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

[go-nuts] Re: Carting int to bool and the reverse for bit hacking ?

2020-11-20 Thread b.ca...@pobox.com
On Friday, 20 November 2020 at 09:26:57 UTC christoph...@gmail.com wrote: > The use case I have to test if an integer is in a quite small constant set > of integers. With bool <-> int conversion, we can use binary operation like > this for instance which would be valid in C > > r :=

[go-nuts] Re: Carting int to bool and the reverse for bit hacking ?

2020-11-20 Thread b.ca...@pobox.com
On Friday, 20 November 2020 at 09:26:57 UTC christoph...@gmail.com wrote: > A handy feature of bool <-> int conversion is that true is converted to 1 > and any integer different of zero to true. As a consequence, when we write > int(bool(x)) we get 0 when x is 0, and 1 when x is not 0. > I