Re: [go-nuts] Question regarding gob

2019-03-26 Thread Michael Jones
There is certainly no reason why pointer semantic meaning cannot be supported in encode/decode tools for Go. It does not seem hard to do, but there was a choice not to do it. I shared my understanding of the reason, but that's not a suggestion of difficulty or impossibility. The most natural imple

[go-nuts] Re: wasm output and modules

2019-03-26 Thread Agniva De Sarker
You can use "-ldflags='-s -w'" to reduce the size, but it is expected that wasm files will be in the order of MBs (see https://golang.org/doc/go1.11#wasm). > So I was wondering if there are tools that parse the .wasm and prune unused pkgs? The size is not due to unused packages being imported

Re: [go-nuts] net.Conn types: File vs SyscallConn method

2019-03-26 Thread Ian Lance Taylor
On Mon, Mar 25, 2019 at 11:04 AM Matt Layher wrote: > > I've been doing low-level networking work in Go for a few years now, but I > had a realization the other day: > > With the addition of the SyscallConn method in Go 1.9 to several > net.Conn/PacketConn types, what is the advantage of using t

Re: [go-nuts] Question regarding gob

2019-03-26 Thread Robert Engels
Yes, when using pointers and cycles you need to either use ids in the encoding or break the cycle by dropping the cyclic fields (for example, a simple ‘parent’ field causes an infinite cycle so drop it and make it implicit) > On Mar 26, 2019, at 2:27 PM, Thomas Bushnell, BSG > wrote: > > I me

Re: [go-nuts] rand.Rand.Seed() vs rand.NewSource()

2019-03-26 Thread Ian Lance Taylor
On Tue, Mar 26, 2019 at 11:48 AM Liam Breck wrote: > > Could anyone clarify the difference between these two? > > r := rand.New(rand.NewSource(...)) > > var r rand.Rand; r.Seed(...) Well, it's not a complete program, and maybe I'm missing something, but it seems to me that the difference is that

[go-nuts] Re: Generis, yet another Generic go code generator... ;)

2019-03-26 Thread Ecstatic Coder
Indeed this one is nice too. And quite simple to use compared to several other solutions :) I'm always astonished by the incredible number of code generation solutions that Go developers have implemented to emulate strongly-typed generics in Go. In my own case, I've opted for an all-in-one to

Re: [go-nuts] Question regarding gob

2019-03-26 Thread 'Thomas Bushnell, BSG' via golang-nuts
I mean, everything except the things that are not pointers. On Tue, Mar 26, 2019 at 2:45 PM Robert Engels wrote: > This is not really true. In Java everything is a pointer (reference) and > has no problem with the semantics of passing a reference, it is built into > the serialization. They may b

Re: [go-nuts] Question regarding gob

2019-03-26 Thread Burak Serdar
On Tue, Mar 26, 2019 at 12:45 PM Robert Engels wrote: > > This is not really true. In Java everything is a pointer (reference) and has > no problem with the semantics of passing a reference, it is built into the > serialization. They may be in fact passed as a pointer (local rpc) or passed > as

[go-nuts] rand.Rand.Seed() vs rand.NewSource()

2019-03-26 Thread Liam Breck
Could anyone clarify the difference between these two? r := rand.New(rand.NewSource(...)) var r rand.Rand; r.Seed(...) -- 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 ema

Re: [go-nuts] Question regarding gob

2019-03-26 Thread Robert Engels
This is not really true. In Java everything is a pointer (reference) and has no problem with the semantics of passing a reference, it is built into the serialization. They may be in fact passed as a pointer (local rpc) or passed as a copy of the object graph, or something in between (custom).

[go-nuts] Re: How to use godoc with Go's module?

2019-03-26 Thread Agniva De Sarker
godoc doesn't work in module mode yet. The workaround is to create a directory resembling a GOPATH and put your project there and set the GOPATH variable to that. Tracking issue here - https://github.com/golang/go/issues/26827 On Tuesday, 26 March 2019 18:07:23 UTC+5:30, Weerasak Chongnguluam

Re: [go-nuts] Question regarding gob

2019-03-26 Thread Tyler Compton
When we think of pointers as what they literally are, an address to a space in memory, it sounds reasonable for Gob to not support them. Things get more unclear when we consider that, in practice, Go programmers often use pointers as a replacement for option types. Without pointers, I don't know ho

Re: [go-nuts] Question regarding gob

2019-03-26 Thread Michael Jones
To be clear here as educators, it is important to point out that exporting / persisting / sending a pointer is an awkward concept. The normal meanings of sending data beyond an executing program have no direct use for the pointer’s literal value; “the thing at location 12345 in the memory of a pro

Re: [go-nuts] Question regarding gob

2019-03-26 Thread roger peppe
On Mon, 25 Mar 2019 at 14:45, Glen Huang wrote: > Thanks for the reply, Sameer. > > Being able to directly send go types is a really big plus for me, I wonder > if I really want to use gob, are there any recommended rpc choices? > Note that gob has at least one significant limitation when encodi

Re: [go-nuts] How to write bson.M format Golang

2019-03-26 Thread Burak Serdar
On Tue, Mar 26, 2019 at 4:05 AM wrote: > > Hi, > > Am using mongodb as database. Am able to query the database from the command > line using the command > > db.nfinstances.distinct("ipv4Addresses",{"nfType":"AMF", "amfInfo.amfSetId": > "3fa85f64-5717-4562-b3fc-2c963f66af33"}) > > and this give m

Re: [go-nuts] why add the useless function in interface?

2019-03-26 Thread Ian Davis
On Tue, 26 Mar 2019, at 12:37 PM, XiaoBing Jiang wrote: > Hi, all: > > in src/cmd/compile/internal/syntax/nodes.go, why need the aNode() function in > the interface? > > type Node interface { > // Pos() returns the position associated with the node as follows: > // 1) The position of a node repr

[go-nuts] How to use godoc with Go's module?

2019-03-26 Thread singpor
I try to use `godoc` to render package's documentation of module. But `godoc` parsing only packages in `GOPATH`. How to use `godoc` with Go's module or have alternative tool to render document of Go's module? -- You received this message because you are subscribed to the Google Groups "golang-

[go-nuts] why add the useless function in interface?

2019-03-26 Thread XiaoBing Jiang
Hi, all: in src/cmd/compile/internal/syntax/nodes.go, why need the aNode() function in the interface? type Node interface { // Pos() returns the position associated with the node as follows: // 1) The position of a node representing a terminal syntax production //(Name, BasicLit, etc.) is th

[go-nuts] wasm output and modules

2019-03-26 Thread whitehexagon via golang-nuts
I know that the Go wasm support is still experimental, although it seems to be working great here! :) but are there any tools for pruning the .wasm output? I'm only using about 3 pkg imports but end up with a 2.6MB .wasm file. I've seen the suggestion for using tinygo, but I didnt get that wo

[go-nuts] How to write bson.M format Golang

2019-03-26 Thread afriyie . abraham
Hi, Am using mongodb as database. Am able to query the database from the command line using the command db.nfinstances.distinct("ipv4Addresses",{"nfType":"AMF", "amfInfo.amfSetId": "3fa85f64-5717-4562-b3fc-2c963f66af33"}) and this give me ipaddress [x.x.x.x] output that i want. mongo command

[go-nuts] Re: Generis, yet another Generic go code generator... ;)

2019-03-26 Thread mmatczuk
You may be also interested in https://github.com/mmatczuk/go_generics (the credit goes to Google). With it you can write a generic code that actually compiles and change the types later ex. https://github.com/scylladb/go-set/tree/master/internal/set W dniu poniedziałek, 25 marca 2019 15:58:03 U

[go-nuts] Bootstrap CRUD on several tables

2019-03-26 Thread Kai Hendry
Hi there, I'm looking for a tool to help create a RestFUL interface on a MariaDB database with many several tables. There are plenty of tutorials on this topic like that of https://github.com/kelvins/GoApiTutorial [1] however it's _very_ labourious to do this for anything more than a couple of