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

2022-10-20 Thread Amnon
Unrelated. But it may be worth updating to Go 1.19 as Go 1.15 over 2 years old, and no longer supported. To get an answer to your original question, I would post a code snippet here which reproduces the problem. Also, do you know what triggers this error condition? On Thursday, 20 October 2022

Re: [go-nuts] Error Handling Question

2022-10-20 Thread 'Daniel Lepage' via golang-nuts
On Thu, Oct 20, 2022 at 5:36 PM Ian Lance Taylor wrote: > On Thu, Oct 20, 2022 at 2:14 PM 'Daniel Lepage' via golang-nuts > wrote: > > > > I'm not sure if this is the right forum to ask this question - please > let me know if there's somewhere better! > > > > I'm wondering why most of the Go 2

Re: [go-nuts] Error Handling Question

2022-10-20 Thread Ian Lance Taylor
On Thu, Oct 20, 2022 at 2:14 PM 'Daniel Lepage' via golang-nuts wrote: > > I'm not sure if this is the right forum to ask this question - please let me > know if there's somewhere better! > > I'm wondering why most of the Go 2 error handling proposals I've seen are > intent on not letting a

[go-nuts] Error Handling Question

2022-10-20 Thread 'Daniel Lepage' via golang-nuts
Hi all, I'm not sure if this is the right forum to ask this question - please let me know if there's somewhere better! I'm wondering why most of the Go 2 error handling proposals I've seen are intent on not letting a function continue after detecting an error - this seems weird to me, since we

Re: [go-nuts] Non-mutable / readonly slices?

2022-10-20 Thread Robert Engels
I think it you review github.com/robaho/leveldb you’ll see that returning a copy works fine and has very little performance impact. If the caller then modifies it - that’s on them. Still, you could return an object like Value that is immutable with accessor methods. You almost always need a

Re: [go-nuts] go runtime in shared libs functions called in threads

2022-10-20 Thread Peter Galbavy
Thanks for the detail. We cannot change the calling program, just conform to it's API, so it's one function call per email send event and each in it's own (new) thread. On Thursday, 20 October 2022 at 12:28:12 UTC+1 Konstantin Khomoutov wrote: > On Wed, Oct 19, 2022 at 06:28:20AM -0700, Peter

Re: [go-nuts] Non-mutable / readonly slices?

2022-10-20 Thread Aaron Rubesh
In general, no. Each time you pass around a []byte you are actually passing around a copy of a pointer to the slice. Modifications will affect the underlying slice. You can use arrays instead, which are always PBV. Take care though, if you try to pass an array to a function accepting a slice

Re: [go-nuts] Non-mutable / readonly slices?

2022-10-20 Thread Ian Lance Taylor
On Thu, Oct 20, 2022 at 5:46 AM Slawomir Pryczek wrote: > > Hi Guys, writing a quick K/V caching system and have a performance related > question. > > Will be operating on []byte, for the system to be thread safe we need to > create a copy of data before each SET so we're sure that the slice

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

2022-10-20 Thread Michael Ellis
I did a quick search for "is not a defined function". That message appears once in https://go.dev/src/text/template/exec.go. It's triggered when findFunction() fails while executing a template. Hope that's of some use. On Wednesday, October 19, 2022 at 8:20:46 AM UTC-4 rit...@ext.dunzo.in

Re: [go-nuts] Zero-sized data type

2022-10-20 Thread Konstantin Khomoutov
On Thu, Oct 13, 2022 at 10:45:33AM -0700, Richiise Nugraha wrote: > The field can't be reordered. > I want to use zero-sized data type to mark offset and has no effect on > struct size, I can take the address of it and use it like: > ```go > c := ... > cmd := (*[SIZE]byte)(unsafe.Pointer()) >

Re: [go-nuts] gollvm build fails

2022-10-20 Thread 'Than McIntosh' via golang-nuts
>There is no zgoarch.go file in the build area. It seems that it was not created by the build system. I've oversimplified things a bit -- what cmake does is write out tools/gollvm/libgo/zgoarch.go.tmp, and then add a build rule for zgoarch.go that copies the *.tmp file to the *.go file if they

[go-nuts] Non-mutable / readonly slices?

2022-10-20 Thread Slawomir Pryczek
Hi Guys, writing a quick K/V caching system and have a performance related question. Will be operating on []byte, for the system to be thread safe we need to create a copy of data before each SET so we're sure that the slice which gets added to pool can't be modified. This shouldn't be

Re: [go-nuts] go runtime in shared libs functions called in threads

2022-10-20 Thread Konstantin Khomoutov
On Wed, Oct 19, 2022 at 06:28:20AM -0700, Peter Galbavy wrote: > I have built a shared lib in Go to replace an old thing we use to send > email - mainly to modernise things and add TLS and authentication. We run > each call to the entry point in it's own thread in the main program. > > I am