Re: [go-nuts] [generics] type constraint for structs

2024-04-03 Thread 'Axel Wagner' via golang-nuts
How does `interface{ AsElement() *Element }` not do exactly what you want? On Thu, Apr 4, 2024 at 4:14 AM atd...@gmail.com wrote: > Might have come across this today as I was trying to simplify some code. > > Basically, I have a base type called *Element that has a method > AsElement() *Element

Re: [go-nuts] net/http: no Client API to close server connection based on Response #21978

2024-04-03 Thread Robert Engels
Happy that it sparked an idea. I also don’t think Eli’s concern is valid. if there are other requests in flight (on different connections I assume) - let those continue - just put any new requests on a new transport for that host (after a 500 error is encountered) - then tear down the bad when it h

Re: [go-nuts] [generics] type constraint for structs

2024-04-03 Thread atd...@gmail.com
Ah, I forgot to use reflection for instance... That might be doable. On Thursday, April 4, 2024 at 4:13:35 AM UTC+2 atd...@gmail.com wrote: > Might have come across this today as I was trying to simplify some code. > > Basically, I have a base type called *Element that has a method > AsElement()

Re: [go-nuts] [generics] type constraint for structs

2024-04-03 Thread atd...@gmail.com
Might have come across this today as I was trying to simplify some code. Basically, I have a base type called *Element that has a method AsElement() *Element that returns itself. And this base element is used as a base for many others, for isntance: type Div struct{ *Element} type Span struct{*

Re: [go-nuts] [generics] type constraint for structs

2024-04-03 Thread Adam Manwaring
While this would make some things much easier for me, it seems this would be a pretty fundamental change. Constraints are essentially interfaces and interfaces in Go are defined by behaviors. Structs, on the other hand, are defined by properties. There is no behavior that all structs have that

Re: [go-nuts] net/http: no Client API to close server connection based on Response #21978

2024-04-03 Thread Jim Minter
Yes, I agree, I think this approach makes sense (and should have been obvious to me as something to try...). It could be implementable as a wrapper transport too. I'll try it out and reply back here if it doesn't work. Thank-you! Jim On Wed, 3 Apr 2024 at 12:46, Robert Engels wrote: > Just

Re: [go-nuts] net/http: no Client API to close server connection based on Response #21978

2024-04-03 Thread Robert Engels
Just create a recyclable transport for the bad server and put all of the rest on a single shared transport. If one connection is returning 500 for all requests I can’t see how a different connection would solve that - unless the backend is completely broken. On Apr 3, 2024, at 7:48 AM, Eli Lindsey

Re: [go-nuts] Re: CMSSignedData in Golang

2024-04-03 Thread Karlovsky Alexey
You can wrap your java BC code in http server and access it with golang http client, also, you can wrap your BC code in CLI tool and exec java process with os.exec. But, as I can understand you need CMS signature for xml content, with golang you can do CMS signatures with https://github.com/fullsa

[go-nuts] [security] Go 1.22.2 and Go 1.21.9 are released

2024-04-03 Thread announce
Hello gophers, We have just released Go versions 1.22.2 and 1.21.9, minor point releases. These minor releases include 1 security fixes following the security policy : - http2: close connections when receiving too many headers Maintaining HPACK state requ

Re: [go-nuts] net/http: no Client API to close server connection based on Response #21978

2024-04-03 Thread Eli Lindsey
It would work, but has potentially high cost since it also causes any healthy conns in the pool to be torn down. How useful it is in practice depends on request rate, number of backends behind the lb, and ratio of healthy to unhealthy (500’ing) connections. It’s hard to tell from the description

[go-nuts] Re: CMSSignedData in Golang

2024-04-03 Thread Shivli Srivastava
If I have to call my java code from golang application , how can I integrate it ? On Wednesday, April 3, 2024 at 5:21:28 PM UTC+5:30 Shivli Srivastava wrote: > I tried with pkcs7, but for the same canonical input the digest is > matching but the signature format is not similar to the one gener

[go-nuts] Re: CMSSignedData in Golang

2024-04-03 Thread Shivli Srivastava
I tried with pkcs7, but for the same canonical input the digest is matching but the signature format is not similar to the one generated by Java Bouncy Castle On Tuesday, April 2, 2024 at 8:17:52 PM UTC+5:30 Tamás Gulácsi wrote: > Earlier questions bubbled up > https://pkg.go.dev/github.com/fu

Re: [go-nuts] user process instruction pointer symbol lookup

2024-04-03 Thread 'TheDiveO' via golang-nuts
Thank you Ian! Not sure yet if I found something useful related to the real process addresses/offsets, but at least the "bcc" sources have one "bcc_elf_get_text_scn_info()" that returns the address and offset of the ".text" section. On Tuesday, April 2, 2024 at 8:01:11 PM UTC+2 Ian Lance Taylo

Re: [go-nuts] net/http: no Client API to close server connection based on Response #21978

2024-04-03 Thread Robert Engels
That probably wasn’t clear. Why not create a Transport per host. Then when the 500 is encountered stop using that transport completely and create a new instance. Probably want to cancel any requests currently in flight. The connection pool is per transport. On Apr 2, 2024, at 11:05 PM, Eli Lindsey

[go-nuts] Go X/Tools SSA init$guard

2024-04-03 Thread Xie Yuchen
I tried to write the SSA information out and found the *init$guard *which is likely to decide the execution of the sub-packages *init *functions. For example, give the following go code, I will get the SSA output. package main import "fmt" import _ "unsafe" const message = "Hello, World!" fun