Re: [go-nuts] Re: Trying to understand aversion to main package

2024-02-14 Thread Mike Schinkel
Hi Jerry, On Wed, 2024-02-14 at 15:31 -0800, Jeremy French wrote: > I really think the testability issue is the biggest one. On Wednesday, February 14, 2024 at 7:37:11 PM UTC-5 Dan Kortschak wrote: With a Main() int, you can use e.g.

Re: [go-nuts] Re: Trying to understand aversion to main package

2024-02-14 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2024-02-14 at 15:31 -0800, Jeremy French wrote: > I really think the testability issue is the biggest one.  Generally, > testing the main package iscumbersome at least.  So it's > reasonable to say, "I'm not going to test the main package, but I > will keep it so simple that it is

[go-nuts] Re: Trying to understand aversion to main package

2024-02-14 Thread Jerry Londergaard
On Thursday 15 February 2024 at 10:31:40 am UTC+11 Jeremy French wrote: I really think the testability issue is the biggest one. Generally, testing the main package iscumbersome at least. So it's reasonable to say, "I'm not going to test the main package, but I will keep it so simple

[go-nuts] Re: Trying to understand aversion to main package

2024-02-14 Thread Jeremy French
I really think the testability issue is the biggest one. Generally, testing the main package iscumbersome at least. So it's reasonable to say, "I'm not going to test the main package, but I will keep it so simple that it is impossible for a bug to exist in there." Then everything else

[go-nuts] Re: Trying to understand aversion to main package

2024-02-14 Thread Jerry Londergaard
On Wednesday 14 February 2024 at 10:23:37 pm UTC+11 Mike Schinkel wrote: I cannot speak for others but I can tell you why I keep my `main()` small: 1. I prefer to put as much logic into reusable packages as I can, and `main()` is not reusable outside the current app. This is understandable.

[go-nuts] XML Canonicalization and signing

2024-02-14 Thread Shivli Srivastava
I have the task of generating the digital signature of an xml, enveloping it in a PKCS7 packet and attaching it to the xml . I decided to use https://pkg.go.dev/go.mozilla.org/pkcs7 , and was able to generate the sign but it is not matching with the expected output . It seems to me that xml

Re: [go-nuts] big int panic on text conversion

2024-02-14 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2024-02-14 at 12:24 +0100, Jan Mercl wrote: > On Wed, Feb 14, 2024 at 12:14 PM 'Dan Kortschak' via golang-nuts > wrote: > > > Given that this can happen without a race or unsafe modifications > > it > > might be worth filing a issue for. > > I think this is expected. Quoting from the

Re: [go-nuts] Trying to understand aversion to main package

2024-02-14 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2024-02-14 at 03:12 -0800, Jerry Londergaard wrote: > I see quite a few modules out there where they seem to be putting in > as little into the main package as possible. Literally they will > sometimes be a few lines: > ``` > import foobar > func main() { >     os.Exit(foobar.Run()) > } >

Re: [go-nuts] big int panic on text conversion

2024-02-14 Thread Jan Mercl
On Wed, Feb 14, 2024 at 12:14 PM 'Dan Kortschak' via golang-nuts wrote: > Given that this can happen without a race or unsafe modifications it > might be worth filing a issue for. I think this is expected. Quoting from the big.Int docs https://pkg.go.dev/math/big#Int To "copy" an Int

[go-nuts] Re: Trying to understand aversion to main package

2024-02-14 Thread Mike Schinkel
I cannot speak for others but I can tell you why I keep my `main()` small: 1. I prefer to put as much logic into reusable packages as I can, and `main()` is not reusable outside the current app. 2. CLI packages like Viper are configured to be invoked with just one or a few small commands in

Re: [go-nuts] big int panic on text conversion

2024-02-14 Thread 'Dan Kortschak' via golang-nuts
On Wed, 2024-02-14 at 02:07 -0800, Poonai wrote: > Thanks all, > > figured out the issue: > > func main() { >     a := big.NewInt(1) >     b := *a >     c := *a >     c.Sub(, big.NewInt(1)) >     fmt.Println(b.String()) >     fmt.Println(c.String()) >     fmt.Println(a.String()) > } > > >

[go-nuts] Trying to understand aversion to main package

2024-02-14 Thread Jerry Londergaard
I see quite a few modules out there where they seem to be putting in as little into the main package as possible. Literally they will sometimes be a few lines: ``` import foobar func main() { os.Exit(foobar.Run()) } ``` Yet then go on to do all the things I would've thought are the domain of

Re: [go-nuts] big int panic on text conversion

2024-02-14 Thread Poonai
Thanks all, figured out the issue: func main() { a := big.NewInt(1) b := *a c := *a c.Sub(, big.NewInt(1)) fmt.Println(b.String()) fmt.Println(c.String()) fmt.Println(a.String()) } reproducible code. don't know what causing it tho :( On Wednesday, February 14, 2024

Re: [go-nuts] big int panic on text conversion

2024-02-14 Thread 'Brian Candler' via golang-nuts
Have you tried running your entire code under the race detector? https://go.dev/blog/race-detector On Wednesday 14 February 2024 at 06:02:02 UTC Kurtis Rader wrote: > Maybe provide a minimal reproducible example ( > https://stackoverflow.com/help/minimal-reproducible-example)? > > While it is