Re: [go-nuts] Error Handling Question

2022-10-22 Thread Brian Candler
> And I agree that the above function is much easier to read and much faster to write than the first version! But now I'm raising unchecked exceptions instead of handling errors properly. However you're not "raising an unchecked exception"; you're panicking, which is something different. Go

[go-nuts] Any information about adding a trailing comma in ast CompositeLit (for structs)

2022-10-22 Thread Tajmeet Singh
Hello, I've been working on a utility to generate constructors for me when I provide it with a path to the file containing the struct and it `Ident`. The idea was that I would just create a ast.Node (FuncDecl) with all the necessary fields but I'm not able to figure out the positioning of the

[go-nuts] What is the best way to write MarshalBinary if the data is a sequence of ints

2022-10-22 Thread Travis Keep
The type I am writing can be easily encoded as a sequence of ints. When I wrote MarshalBinary for my type, I decided to GobEncode this sequence of ints to a byte buffer and return the bytes. I learned that GobEncoding an empty slice of int takes 18 bytes. So even for small instances of my

Re: [go-nuts] Facing issues while using builtin functions while executing golang templates

2022-10-22 Thread Martin Schnabel
Hi Ritesh, I am no expert on these matters, but have you thought about defective memory on this specific machine? I certainly looks very wrong to me and the first thing i would try is run an extensive memory test. If your systems memory is faulty, then all bets are off and trying to debug