Re: [go-nuts] Create a XML signature my XML DATA

2022-12-22 Thread Karlovsky Alexey
Hi, I believe you have used the default SigningContext with the NewDefaultSigningContext method with default MakeC14N11Canonicalizer: func NewDefaultSigningContext(ks X509KeyStore) *SigningContext { return &SigningContext{ Hash: crypto.SHA256, KeyStore: ks,

[go-nuts] Generic "nillable" constraint

2022-12-22 Thread Pierre Durand
Is there a way to declare a "nillable" constraint that matches all types that can be nil (pointer, slice, map, etc.) ? I would like to write a function, that receives a parameter (with a generic type), and check if this parameter is nil. I found a very ugly way to write it: https://go.dev/play/p

[go-nuts] Re: Generic "nillable" constraint

2022-12-22 Thread Pierre Durand
Same question for `len()`: is there a way to declare a constraint that matches types that support `len()` ? Le jeudi 22 décembre 2022 à 14:23:22 UTC+1, Pierre Durand a écrit : > Is there a way to declare a "nillable" constraint that matches all types > that can be nil (pointer, slice, map, etc.

Re: [go-nuts] Generic "nillable" constraint

2022-12-22 Thread 'Axel Wagner' via golang-nuts
On Thu, Dec 22, 2022 at 2:23 PM Pierre Durand wrote: > Is there a way to declare a "nillable" constraint that matches all types > that can be nil (pointer, slice, map, etc.) ? There is currently no way to do that. In particular, any interface type can be `nil`, therefore any such constraint wou

Re: [go-nuts] Re: Generic "nillable" constraint

2022-12-22 Thread 'Axel Wagner' via golang-nuts
On Thu, Dec 22, 2022 at 2:24 PM Pierre Durand wrote: > Same question for `len()`: is there a way to declare a constraint that > matches types that support `len()` ? For this, the workaround you posted works, at least. It's not convenient, but it also does not seem like a common need - again I'd

Re: [go-nuts] Re: Generic "nillable" constraint

2022-12-22 Thread Pierre Durand
OK thank you, that confirms what I was thinking. Indeed it's not a common need. I wanted to know if it was possible to rewrite https://pkg.go.dev/github.com/stretchr/testify/assert#Nil with a "nillable" constraint instead of "interface{}". Le jeudi 22 décembre 2022 à 14:43:51 UTC+1, axel.wa...

Re: [go-nuts] Create a XML signature my XML DATA

2022-12-22 Thread Karlovsky Alexey
I would try to load key and cert from pfx using this library https://github.com/SSLMate/go-pkcs12 On Thu, Dec 22, 2022 at 1:13 PM Reeturaj Sahoo wrote: > Hello Alexey, > > It's working now , now able to set configuration as per requirement. > > I believe this function is used for random key gene

[go-nuts] gopls: How to suppress a warning?

2022-12-22 Thread Torsten Bronger
Hallöchen! My text editor uses gopls output to enrich the display of the source code. Unfortunately, I have “struct literal uses unkeyed fields” all over the place. I don’t want to do anything about it because this would bloat by bson.D literals (currently interacting with MongoDB). So, how can

[go-nuts] What are the best practices to write test-cases?

2022-12-22 Thread Nishant Mishra
Hi everyone! I am new to Golang and currently trying to research about Golang and what are the best practices for writing test-cases in Golang. While I have been able to find some resources online, I still have a doubt that I hope you can help me with. My doubt is related to the best practices f

[go-nuts] CGO core dump analysis using GDB

2022-12-22 Thread mariappan balraj
Hi, I have following programming where making CGO from GO code. test3() is called from Go code. Which calls test2() and which calls test1(). In test1(), there is a NULL pointer assignment. I could able to generate the core dump when running the program. But when I use gdb, I am not getting the

Re: [go-nuts] Create a XML signature my XML DATA

2022-12-22 Thread Reeturaj Sahoo
Hello Alexey, It's working now , now able to set configuration as per requirement. I believe this function is used for random key generation randomKeyStore := dsig.RandomKeyStoreForTest() want to use previously generated .pfx file, key password . Anu suggestion to implement. On Thu, Dec 22,

Re: [go-nuts] Create a XML signature my XML DATA

2022-12-22 Thread Reeturaj Sahoo
Hello Karlovsky, Thank you for the update . After using this library I was able to generate Signed XML . Output is : http://www.w3.org/2000/09/xmldsig#";> http://www.w3.org/2006/12/xml-c14n11 "/> http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/> http://www.w3.org/2000/09/xmldsig#envelop

[go-nuts] Re: gopls: How to suppress a warning?

2022-12-22 Thread 'Robert Findley' via golang-nuts
You can disable the "composites" analyzer: https://github.com/golang/tools/blob/master/gopls/doc/analyzers.md#composites Update the "analyses" configuration to include "composites": false, as described here: https://github.com/golang/tools/blob/master/gopls/doc/settings.md#analyses-mapstringbo