[go-nuts] Re: JSON and Embedded Types (Aliases)

2018-01-21 Thread dc0d
Then the main question would be why is it possible to embed type aliases? On Sunday, January 21, 2018 at 10:42:28 PM UTC+3:30, Kevin Malachowski wrote: > > Given the last playground post, I'd guess that the aliased type (i.e. > 'int' here) is being used for visibility rather than the alias's new

[go-nuts] Re: How to output coverage profile data for multiple packages?

2018-01-21 Thread cceckman
(Since this is the top result for this issue): Ran into this myself, and was surprised to find the coverage run passed at tip (but not 1.8 or 1.9.) Looks like this is fixed in the 1.10 ca

[go-nuts] Re: Go schedule latency issue

2018-01-21 Thread sotter . liu
I tested two scenarios for the priority value(19 and -19). The priority setting does affect the waf-client rt : *➜ waf-client git:(master) ✗ nice -n -19 ./waf-client* nice: setpriority: Permission denied 2018/01/22 10:37:47 Add Client : 0.0.0.0:8000 2018/01/22 10:37:47 --

[go-nuts] Re: resource cleanup in closure

2018-01-21 Thread 'simon place' via golang-nuts
after a bit of thought, its not ideal. it would work, but defeats part of the objective, which was for the optimisations to be transparent, having the defer, or callbacks, in the calling function breaks the isolation. i could insert callbacks in the base code which would just be redundant when

[go-nuts] Re: resource cleanup in closure

2018-01-21 Thread 'simon place' via golang-nuts
that might do it, the closures are actually being made by a New(type) call, and i was basically fixated by returning only the new instance (and maybe a error), but no reason not to return a callback destructor. maybe New isn't the right name anymore? the idea is to incrementally add a registry

[go-nuts] Re: resource cleanup in closure

2018-01-21 Thread matthewjuran
Have the closure generator return the resource? https://play.golang.org/p/16pyo0gh8_s I'm not sure what you mean by using types instead, or even why you are trying to do this. Can you explain more? Matt On Sunday, January 21, 2018 at 3:17:20 PM UTC-6, simon place wrote: > > i wrote the code be

[go-nuts] resource cleanup in closure

2018-01-21 Thread 'simon place' via golang-nuts
i wrote the code below hoping that defer() would run when a funcs context was lost, not just when it ended.(which, without using closures, would always be the same thing, i think.) https://play.golang.org/p/HBrmBOkK1zJ as can be seen it doesn't, which begs the question; "how do you clean up ex

Re: [go-nuts] Is there something similar to cmp in python?

2018-01-21 Thread matthewjuran
Bytes has one too: https://golang.org/pkg/bytes/#Compare Matt On Sunday, January 21, 2018 at 12:59:21 PM UTC-6, Arie van Wingerden wrote: > > https://golang.org/src/strings/compare.go > > 2018-01-21 14:42 GMT+01:00 Peng Yu >: > >> Hi, cmp() in python can return three values -1, 0, 1. Is there a >

[go-nuts] Re: JSON and Embedded Types (Aliases)

2018-01-21 Thread Kevin Malachowski
Given the last playground post, I'd guess that the aliased type (i.e. 'int' here) is being used for visibility rather than the alias's new name. It's also a little weird to use embedded types that dont need to be (there's no method promotion here because 'int' has no methods), or seeing aliases

Re: [go-nuts] Is there something similar to cmp in python?

2018-01-21 Thread Arie van Wingerden
https://golang.org/src/strings/compare.go 2018-01-21 14:42 GMT+01:00 Peng Yu : > Hi, cmp() in python can return three values -1, 0, 1. Is there a > comparison function in golang that also return three values? Thanks. > > https://docs.python.org/2/library/functions.html#cmp > > -- > Regards, > Pen

Re: [go-nuts] Is there something similar to cmp in python?

2018-01-21 Thread Peng Yu
This only applies to string but not other types like int. On Sun, Jan 21, 2018 at 8:18 AM Arie van Wingerden wrote: > https://golang.org/src/strings/compare.go > > 2018-01-21 14:42 GMT+01:00 Peng Yu : > >> Hi, cmp() in python can return three values -1, 0, 1. Is there a >> comparison function in

Re: [go-nuts] where is an online version of older versions like 1.8 1.6 golang pkg doc ?

2018-01-21 Thread derek
On Fri, Jan 19, 2018 at 10:07 AM, Ian Lance Taylor wrote: > Sounds like a good approach. Or I'm also open to someone writing the > necessary code for golang.org. I just started this approach simply serving static html files: https://golangdoc.github.io/pkg/1.10beta2/ https://golangdoc.github.io

Re: [go-nuts] Re: Is there something similar to cmp in python?

2018-01-21 Thread Jan Mercl
On Sun, Jan 21, 2018 at 5:54 PM wrote: > Sounds good to me. I'm not familiar with any performance tradeoffs like branch prediction changes, but I assume the compiler result is equivalent. A sufficiently smart compiler can emit zero conditional branches within CmpX, regardless of the form. --

Re: [go-nuts] Re: Is there something similar to cmp in python?

2018-01-21 Thread matthewjuran
Sounds good to me. I'm not familiar with any performance tradeoffs like branch prediction changes, but I assume the compiler result is equivalent. func CmpX(x, y X) int { if x == y { return 0 } if x < y { return -1 } return 1 } Matt On Sunday, January 21, 201

Re: [go-nuts] Re: Is there something similar to cmp in python?

2018-01-21 Thread Jan Mercl
On Sun, Jan 21, 2018 at 4:32 PM wrote: All the else clauses should be dropped. -- -j -- 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 golang-nuts+unsubscr..

[go-nuts] Re: Graven: Build tool for Go projects.

2018-01-21 Thread matthewjuran
Hi Clinton, here’s a code review. Does BuildTool need to be an interface? Having methods on a pointer to nothing (type GoBuildTool struct{}) seems unnecessary to me. Also, why not have this at the level of package main? Same with graven/commands, graven/config, graven/domain, graven/util, since

[go-nuts] Re: Badger Write Performance

2018-01-21 Thread Diego Medina
The use of SyncWrites=false on badger's benchmark was called out on reddit and the benchmark author's reply was along the lines of "it's ok for our use case to lose the last few [seconds|ms] of data" You draw your conclusion on where you want to keep your data. On Thursday, January 18, 2018

[go-nuts] Re: Is there something similar to cmp in python?

2018-01-21 Thread matthewjuran
There isn’t a standard library or built-in function that does both a comparison and less operation. For best performance you would write it for your type. For best generality you would write a library function that takes two interface{} values and converts them to the comparable types that work

Re: [go-nuts] Doc mentioned it's possible to inspect unexported methods using reflect, but I can't figure out how

2018-01-21 Thread matthewjuran
Opening an issue at https://github.com/golang/go/issues should get the change in. Matt On Saturday, January 20, 2018 at 11:16:56 PM UTC-6, Glen Huang wrote: > > Thanks for the reply. > > Hopefully the doc can be changed to avoid confusion. > > On Sunday, January 21, 2018 at 1:16:04 PM UTC+8, Ian

[go-nuts] Re: Is there something like peekable in python?

2018-01-21 Thread matthewjuran
range on slices seem similar. The loop has the current index so looking ahead, behind, or reslicing is convenient. >From https://golang.org/ref/spec#For_statements: For an array, pointer to array, or slice value a, the index iteration > values are produced in increasing order, starting at eleme

[go-nuts] Is there something similar to cmp in python?

2018-01-21 Thread Peng Yu
Hi, cmp() in python can return three values -1, 0, 1. Is there a comparison function in golang that also return three values? Thanks. https://docs.python.org/2/library/functions.html#cmp -- Regards, Peng -- You received this message because you are subscribed to the Google Groups "golang-nuts

[go-nuts] Re: JSON and Embedded Types (Aliases)

2018-01-21 Thread C Banning
https://play.golang.org/p/SiWmBrUYUXF On Saturday, January 20, 2018 at 11:16:20 PM UTC-7, dc0d wrote: > > Playground , output: {"Test":100}. > > On Sunday, January 21, 2018 at 9:42:39 AM UTC+3:30, dc0d wrote: >> >> Why embedded type aliases get ignored throug