Re: [go-nuts] Replicating C unions with unsafe, arrays, and some constant arithmetic

2023-08-24 Thread Kurtis Rader
I googled "emulate c unions in go" to find examples of people wanting to do the same thing. It appears that most (all?) of them are better solved using Go interfaces. While I only spent a few minutes looking at the results of my search I didn't see any examples where something like your trick was

Re: [go-nuts] Replicating C unions with unsafe, arrays, and some constant arithmetic

2023-08-24 Thread Ian Lance Taylor
Note that is not permitted by the rules of the unsafe package, and that in particular it will break the garbage collector if any of the types stored in the union contain pointer fields. Ian On Thu, Aug 24, 2023, 7:59 PM aind...@gmail.com wrote: > I found this trick recently to replicate a C

Re: [go-nuts] Re: From which programming language did the idea for Golang's interface mechanism design originate?

2023-08-24 Thread Rob Pike
It was dreamed up independently at the whiteboard on the first day of design discussions. We did not know Emerald at the time; the similarity was discovered later. This is not to claim the idea is original, just that we discovered it independently. -rob On Fri, Aug 25, 2023 at 1:57 PM Andrew

[go-nuts] Re: From which programming language did the idea for Golang's interface mechanism design originate?

2023-08-24 Thread Andrew Harris
The comments on Go Data Structures: Interfaces mention Emerald , maybe this is what you were thinking of? On Thursday, August 24, 2023 at 8:42:43 PM UTC-7 xie cui wrote: > I remembe someone in a video in

[go-nuts] From which programming language did the idea for Golang's interface mechanism design originate?

2023-08-24 Thread xie cui
I remembe someone in a video in youtube explain the design of interface. But I cann't find it now. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to

[go-nuts] Replicating C unions with unsafe, arrays, and some constant arithmetic

2023-08-24 Thread aind...@gmail.com
I found this trick recently to replicate a C union in Go with unsafe.Sizeof, arrays, and some constant arithmetic. This lets you stack-allocate data that needs to be the max size of multiple other data types. So given a type A and B that you want to union, you can say const ASize =

[go-nuts] Re: custom coverage report

2023-08-24 Thread Jan
hey Vasiliy, I'm not sure I understood your requirements, but let me take a stab at it. By handlers of the protobuf I imagine you refer to those stubs generated by `protoc`, for the gRPCs. Is it correct ? They have well defined names/packages that can easily be filtered (grep?) from the the

Re: [go-nuts] Re: [ANN] go-zeromq/zmq4: pure-Go implementation of ZeroMQ

2023-08-24 Thread Jan
Btw, I should add to it that GoNB , a successor to gophernotes also uses github.com/go-zeromq/zmq4 to communicate with Jupyter -- it's been working flawlessly for that use case. On Thursday, August 24, 2023 at 3:20:49 PM UTC+2 Sebastien Binet wrote: > Hi

[go-nuts] Re: [ANN] go-zeromq/zmq4: pure-Go implementation of ZeroMQ

2023-08-24 Thread Sebastien Binet
Hi there, (Apologies for the belated answer, I am on holidays with patchy network coverage) I had worked on this pure Go library to make the installation of Gophernotes (an IPython kernel for Go) easier (just go-get-able). It was also part of PoC for an IPC-based data acquisition system at

Re: [go-nuts] How to be a good slog module?

2023-08-24 Thread TheDiveO
While my modules can be used in HTTP handlers, they are also often used outside such use cases in other tools. Some modules spawn long-running background go routines, others do complex system scanning operations, finally returning a complex cyclic information model. What I would like to avoid

[go-nuts] Re: custom coverage report

2023-08-24 Thread Vasiliy Tolstov
Anybody knows golang package that can write cover files in desired format? вс, 20 авг. 2023 г. в 17:28, Vasiliy Tolstov : > > Hi. I have service centric tests - so i want to test not each function > inside application, but only it handlers (defined via protobuf) > Also i have custom framework

Re: [go-nuts] Re: [ANN] go-zeromq/zmq4: pure-Go implementation of ZeroMQ

2023-08-24 Thread 'Sebastien Binet' via golang-nuts
Hi there, (Apologies if you get it twice, sent it from my CERN account) (Apologies for the belated answer, I am on holidays with patchy network coverage) I had worked on this pure Go library to make the installation of Gophernotes (an IPython kernel for Go) easier (just go-get-able). It was