[go-nuts] slog's use of runtime.Callers() with a skip

2023-08-04 Thread 'sh...@tigera.io' via golang-nuts
I was looking at replacing logrus with the new slog library in our project. I noticed that it uses runtime.Callers() with a fixed skip to collect the PC of the calling code, presumably to make it possible for the handler t

[go-nuts] CGO export double-definition

2022-01-26 Thread sh...@tigera.io
Hi, I just got bitten by the problem described in the CGO docs: Using //export in a file places a restriction on the preamble: since it is copied into two different C output files, it must not contain any definitions, only declarations. If a file contains both definitions and declarations, the

Re: [go-nuts] Syscalls that take structs with embedded pointers

2021-05-14 Thread sh...@tigera.io
s for handling "C" pointers and "Go" pointers. On Friday, May 14, 2021 at 1:24:28 PM UTC+1 sh...@tigera.io wrote: > Thanks for the pointer to that package; looking at our go.mod, looks like > we've already got it as a transitive dependency so it looks ideal for my > u

Re: [go-nuts] Syscalls that take structs with embedded pointers

2021-05-14 Thread sh...@tigera.io
Thanks for the pointer to that package; looking at our go.mod, looks like we've already got it as a transitive dependency so it looks ideal for my use case. On Friday, May 14, 2021 at 12:10:45 PM UTC+1 Jan Mercl wrote: > On Fri, May 14, 2021 at 12:36 PM sh...@tigera.io wrote: > &g

[go-nuts] Syscalls that take structs with embedded pointers

2021-05-14 Thread sh...@tigera.io
Hi all, I'm looking for a safe way to make a unix syscall where the syscall takes a pointer to a struct and, in turn, the struct needs to contain a pointer to a buffer (for the kernel to read or write to). According to the rules in the unsafe package, I don't think this is safe: buf := [128]by