[go-nuts] Is it necessary to change the behavior of maps.Keys and maps.Values?

2024-12-23 Thread fliter
Since the x/exp/maps era, I have used maps.Keys and maps.Values ​​extensively. They are very useful and avoid users from doing loop iterations. I remember that they were added to the standard library, but I used maps.Keys in the latest go version and was surprised that it could not compile.

Re: [go-nuts] Is it necessary to change the behavior of maps.Keys and maps.Values?

2024-12-23 Thread 'Sebastien Binet' via golang-nuts
Hi, If you want a slice in lieu of an iterator, you can use the slices package and its Collect function : https://pkg.go.dev/slices#Collect hth, -a Dec 24, 2024 05:08:01 fliter : > > > Since the x/exp/maps era, I have used maps.Keys and maps.Values > ​​extensively. They are very useful and

[go-nuts] using runtime cgo.Handle passing chan type

2024-12-23 Thread 'Red' via golang-nuts
Hi, I need to use CGO to call a C function in a Go program, where the parameter type is a void pointer. Now I need to pass a struct to the C function, and the struct contains a channel. Additionally, I have a Go callback function that the C function will call, using the data from this struct. Th

Re: [go-nuts] using runtime cgo.Handle passing chan type

2024-12-23 Thread Ian Lance Taylor
On Mon, Dec 23, 2024 at 8:29 AM 'Red' via golang-nuts wrote: > > I need to use CGO to call a C function in a Go program, where the parameter > type is a void pointer. Now I need to pass a struct to the C function, and > the struct contains a channel. Additionally, I have a Go callback function