[go-nuts] Re: Can't explain Golang benchmarks

2017-07-16 Thread Zohaib Sibte Hassan
Awesome :) got similar results. So channels are slower for pubsub. I am 
surprised so far, with the efficiency going down as the cores go up (heck 
reminds me of that Node.js single core meme). Please tell me I am wrong 
here, is there any other more efficient approach? 

On Sunday, July 16, 2017 at 8:06:44 PM UTC-7, peterGo wrote:
>
> Your latest benchmarks are invalid.
>
> In your benchmarks, replace b.StartTimer() with b.ResetTimer().
>
> Simply run benchmarks. Don't run race detectors. Don't run profilers. For 
> example,
>
> $ go version
> go version devel +504deee Sun Jul 16 03:57:11 2017 + linux/amd64
> $ go test -run=! -bench=. -benchmem -cpu=1,2,4,8 pubsub_test.go
> goos: linux
> goarch: amd64
> BenchmarkPubSubPrimitiveChannelsMultiple2 86328 
> ns/op  61 B/op   2 allocs/op
> BenchmarkPubSubPrimitiveChannelsMultiple-2  3 50844 
> ns/op  54 B/op   2 allocs/op
> BenchmarkPubSubPrimitiveChannelsMultiple-4  1112833 
> ns/op  83 B/op   2 allocs/op
> BenchmarkPubSubPrimitiveChannelsMultiple-8  1160011 
> ns/op  88 B/op   2 allocs/op
> BenchmarkPubSubWaitGroupMultiple   10 21231 
> ns/op  40 B/op   2 allocs/op
> BenchmarkPubSubWaitGroupMultiple-2  1107165 
> ns/op  46 B/op   2 allocs/op
> BenchmarkPubSubWaitGroupMultiple-4  2 73235 
> ns/op  43 B/op   2 allocs/op
> BenchmarkPubSubWaitGroupMultiple-8  2 82917 
> ns/op  42 B/op   2 allocs/op
> PASS
> ok  command-line-arguments15.481s
> $
>
> Peter
>
> On Sunday, July 16, 2017 at 9:51:38 PM UTC-4, Zohaib Sibte Hassan wrote:
>>
>> Thanks for pointing issues out I updated my code to get rid of race 
>> conditions (nothing critical I was always doing reader-writer race). Anyhow 
>> I updated my code on 
>> https://gist.github.com/maxpert/f3c405c516ba2d4c8aa8b0695e0e054e. Still 
>> doesn't explain the new results:
>>
>> $> go test -race -run=! -bench=. -benchmem -cpu=1,2,4,8 
>> -cpuprofile=cpu.out -memprofile=mem.out pubsub_test.go
>> BenchmarkPubSubPrimitiveChannelsMultiple  50  21121694 ns/op   
>>  8515 B/op  39 allocs/op
>> BenchmarkPubSubPrimitiveChannelsMultiple-2   100  19302372 ns/op   
>>  4277 B/op  20 allocs/op
>> BenchmarkPubSubPrimitiveChannelsMultiple-450  22674769 ns/op   
>>  8182 B/op  35 allocs/op
>> BenchmarkPubSubPrimitiveChannelsMultiple-850  21201533 ns/op   
>>  8469 B/op  38 allocs/op
>> BenchmarkPubSubWaitGroupMultiple3000501804 ns/op 
>>  63 B/op   2 allocs/op
>> BenchmarkPubSubWaitGroupMultiple-2   200  15417944 ns/op 
>> 407 B/op   6 allocs/op
>> BenchmarkPubSubWaitGroupMultiple-4   300   5010273 ns/op 
>> 231 B/op   4 allocs/op
>> BenchmarkPubSubWaitGroupMultiple-8   200   5444634 ns/op 
>> 334 B/op   5 allocs/op
>> PASS
>> ok   command-line-arguments 21.775s
>>
>> So far my testing shows channels are slower for pubsub scenario. I tried 
>> looking into pprof dumps of memory and CPU and it's not making sense to me. 
>> What am I missing here?
>>
>> On Sunday, July 16, 2017 at 10:27:04 AM UTC-7, peterGo wrote:
>>>
>>> When you have data races the results are undefined.
>>>
>>> $ go version
>>> go version devel +dd81c37 Sat Jul 15 05:43:45 2017 + linux/amd64
>>> $ go test -race -run=! -bench=. -benchmem -cpu=1,2,4,8 pubsub_test.go
>>> ==
>>> WARNING: DATA RACE
>>> Read at 0x00c4200140c0 by goroutine 18:
>>>   command-line-arguments.BenchmarkPubSubPrimitiveChannelsMultiple()
>>>   /home/peter/gopath/src/nuts/pubsub_test.go:59 +0x51d
>>>   testing.(*B).runN()
>>>   /home/peter/go/src/testing/benchmark.go:141 +0x12a
>>>   testing.(*B).run1.func1()
>>>   /home/peter/go/src/testing/benchmark.go:214 +0x6b
>>>
>>> Previous write at 0x00c4200140c0 by goroutine 57:
>>>   [failed to restore the stack]
>>>
>>> Goroutine 18 (running) created at:
>>>   testing.(*B).run1()
>>>   /home/peter/go/src/testing/benchmark.go:207 +0x8c
>>>   testing.(*B).Run()
>>>   /home/peter/go/src/testing/benchmark.go:513 +0x482
>>>   testing.runBenchmarks.func1()
>>>   /home/peter/go/src/testing/benchmark.go:417 +0xa7
>>>   testing.(*B).runN()
>>>   /home/peter/go/src/testing/benchmark.go:141 +0x12a
>>>   testing.runBenchmarks()
>>>   /home/peter/go/src/testing/benchmark.go:423 +0x86d
>>>   testing.(*M).Run()
>>>   /home/peter/go/src/testing/testing.go:928 +0x51e
>>>   main.main()
>>>   command-line-arguments/_test/_testmain.go:46 +0x1d3
>>>
>>> Goroutine 57 (finished) created at:
>>>   command-line-arguments.BenchmarkPubSubPrimitiveChannelsMultiple()
>>>   /home/peter/gopath/src/nuts/pubsub_test.go:40 +0x290
>>>   testing.(*B).runN()
>>>   

[go-nuts] Re: [Go2] toward-go2

2017-07-16 Thread Nathan Kerr
The active work for Go2 right now is gathering experience reports 
. Most of the changes resulting 
from these reports will land in Go1.x. It is expected that Go2 will only 
have a few major changes that will not be compatible with Go1. It is also 
possible there will be none (and Go1.20 will be called Go2)

The Go2 label in the issue tracker has meant, more or less, that the 
issue/proposal was something that could't be considered for Go1, usually 
because it would be the Go1 compatibility promise, but should be kept track 
of.

Apple didn't mention Swift because Apple doesn't mention things it is 
working on. Working in private and then releasing when things are ready is 
how Apple does things.

On Monday, July 17, 2017 at 5:42:34 AM UTC+2, Gert wrote:
>
> There are so many 
> https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+go2+label%3AGo2 
> proposals already I can barely figure out if feature x y or z is already 
> asked.
>
> Can we have a Go2 branch / milestone please? PS now that you announced 
> toward-go2 you are going to actively work on Go2 right? Its not some kind 
> of lets try to trick developers to keep using Go who are looking for 
> alternatives because they made a Go2 proposal many years ago and gave up 
> hope right? Don't get me wrong I love Go but I hate false promises or 
> making plans ridiculous far in the future. Not saying Go2 can't take a long 
> time to make, just saying i would like to see small bits of code emerging 
> on a weekly bases we can test and play around with and give feedback on 
> real things not just imaginary ideas :) If you can't make a Go2 branch yet 
> and more important things need to be done first on Go1 I understand 
> completely, but once you pull the Go2 card companies will pull back and 
> start waiting for Go2. Its the number one reason Apple didn't mention a 
> single word about Swift until they could deliver a fully functioning 
> compiler just because of that reasons to not jeopardise developers stop 
> learning objective c and waiting for Swift
>

-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: [Ann] Generating go struct from json/yaml

2017-07-16 Thread Tong Sun
Oh, sorry, I meant to begin the message with,

Thanks Aditya,

On Mon, Jul 17, 2017 at 12:43 AM, Tong Sun wrote:

Is the `subStruct` feature working as expected?
>
> You can try testing on the SmartyStreets.json
> 
>  file.
> Thanks.
>

Besides, the recent work done by Ladicle/gojson
 seems to be interesting, and would be
helpful for people in general.


> On Sun, Jul 16, 2017 at 8:15 PM, Aditya Mukerjee wrote:
>
>> Hi Tong,
>>
>> Glad to see you're finding gojson useful. Let us know if you have
>> suggestions; if there are improvements which would be helpful for people in
>> general, we'd be happy to merge them upstream.
>>
>>
>> On Sunday, July 16, 2017 at 10:28:09 AM UTC-4, Tong Sun wrote:
>>>
>>> Hi,
>>>
>>> I've started to improve the tools that generates go struct definitions
>>> from json or yaml documents,
>>> https://github.com/go-jsonfile/gojson#cli-update:
>>>
>>> Using gojson is now deprecated. You can still install and use it, but
>>> better use jsonfiddle j2s
>>>  instead,
>>> because all the improvements will be happening there. Currently the
>>> advantages of jsonfiddle j2s over gojson are:
>>>
>>>
>>>- No longer uses the dummy Foo as the default for the name of the
>>>   struct now, but use the input file name to automatic set the struct 
>>> name
>>>   instead, yet it can be overridden from command line (by --name). Check
>>>   the details here
>>>   
>>> 
>>>   .
>>>   - Internally, much more code consolidation and simplification
>>>   (e.g., input/output file handling) have been done under the hood, so 
>>> the
>>>   hand-edited code has been reduced from over a hundred (132) to just
>>>   several lines
>>>   
>>> 
>>>   .
>>>
>>> Much more enhancements will be taken place, check out details here
>>> .
>>>
>>>
>>>
>>> See also, https://github.com/go-jsonfile/jsonfiddle#credits,
>>>
>>> Credits
>>>
>>>
>>>- Ladicle/gojson  forked source
>>>   for JSON to struct
>>>   - ChimeraCoder/gojson  the
>>>   original source of Ladicle/gojson
>>>   .
>>>
>>>
>>> All patches welcome.
>>>
>>> Thanks
>>>
>>> --
>> You received this message because you are subscribed to a topic in the
>> Google Groups "golang-nuts" group.
>> To unsubscribe from this topic, visit https://groups.google.com/d/to
>> pic/golang-nuts/XfVlTsWx2-Q/unsubscribe.
>> To unsubscribe from this group and all its topics, send an email to
>> golang-nuts+unsubscr...@googlegroups.com.
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: [Ann] Generating go struct from json/yaml

2017-07-16 Thread Tong Sun
Is the `subStruct` feature working as expected?

You can try testing on the SmartyStreets.json

file.
Thanks.

On Sun, Jul 16, 2017 at 8:15 PM, Aditya Mukerjee 
wrote:

> Hi Tong,
>
> Glad to see you're finding gojson useful. Let us know if you have
> suggestions; if there are improvements which would be helpful for people in
> general, we'd be happy to merge them upstream.
>
>
> On Sunday, July 16, 2017 at 10:28:09 AM UTC-4, Tong Sun wrote:
>>
>> Hi,
>>
>> I've started to improve the tools that generates go struct definitions
>> from json or yaml documents,
>> https://github.com/go-jsonfile/gojson#cli-update:
>>
>> Using gojson is now deprecated. You can still install and use it, but
>> better use jsonfiddle j2s
>>  instead,
>> because all the improvements will be happening there. Currently the
>> advantages of jsonfiddle j2s over gojson are:
>>
>>
>>- No longer uses the dummy Foo as the default for the name of the
>>   struct now, but use the input file name to automatic set the struct 
>> name
>>   instead, yet it can be overridden from command line (by --name). Check
>>   the details here
>>   
>> 
>>   .
>>   - Internally, much more code consolidation and simplification
>>   (e.g., input/output file handling) have been done under the hood, so 
>> the
>>   hand-edited code has been reduced from over a hundred (132) to just
>>   several lines
>>   
>> 
>>   .
>>
>> Much more enhancements will be taken place, check out details here
>> .
>>
>>
>>
>> See also, https://github.com/go-jsonfile/jsonfiddle#credits,
>>
>> Credits
>>
>>
>>- Ladicle/gojson  forked source
>>   for JSON to struct
>>   - ChimeraCoder/gojson  the
>>   original source of Ladicle/gojson
>>   .
>>
>>
>> All patches welcome.
>>
>> Thanks
>>
>> --
> You received this message because you are subscribed to a topic in the
> Google Groups "golang-nuts" group.
> To unsubscribe from this topic, visit https://groups.google.com/d/
> topic/golang-nuts/XfVlTsWx2-Q/unsubscribe.
> To unsubscribe from this group and all its topics, send an email to
> golang-nuts+unsubscr...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Programming paradigm.

2017-07-16 Thread Rob Pike
This might help.

https://talks.golang.org/2012/splash.article

-rob


On Mon, Jul 17, 2017 at 3:13 AM, Mayank Acharya 
wrote:

> Dear all,
> I am new to Go language.
>
> I searched a lot to understand it's paradigm structure but still not
> getting clear idea about that.
>
> Please if anyone can explain, go language follows which programming
> paradigm with some clear example for understanding.
>
> I really appreciate responses.
>
> Thank you.
>
> --
> 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...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] [Ann] Interactive Goroutine Dump Analysis Tool

2017-07-16 Thread linuxerwang
https://github.com/linuxerwang/goroutine-inspect

This is a very useful tool which helped us find channel blocking and 
deadlocks in real Golang services. With this tool the analysis time can be 
reduced from one hour to a few minutes.

If you have any idea to improve it, please open an issue or even better 
send a pull request.

- linuxerwang

-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] [Go2] toward-go2

2017-07-16 Thread Gert
There are so 
many https://github.com/golang/go/issues?q=is%3Aissue+is%3Aopen+go2+label%3AGo2 
proposals already I can barely figure out if feature x y or z is already 
asked.

Can we have a Go2 branch / milestone please? PS now that you announced 
toward-go2 you are going to actively work on Go2 right? Its not some kind 
of lets try to trick developers to keep using Go who are looking for 
alternatives because they made a Go2 proposal many years ago and gave up 
hope right? Don't get me wrong I love Go but I hate false promises or 
making plans ridiculous far in the future. Not saying Go2 can't take a long 
time to make, just saying i would like to see small bits of code emerging 
on a weekly bases we can test and play around with and give feedback on 
real things not just imaginary ideas :) If you can't make a Go2 branch yet 
and more important things need to be done first on Go1 I understand 
completely, but once you pull the Go2 card companies will pull back and 
start waiting for Go2. Its the number one reason Apple didn't mention a 
single word about Swift until they could deliver a fully functioning 
compiler just because of that reasons to not jeopardise developers stop 
learning objective c and waiting for Swift

-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Programming paradigm.

2017-07-16 Thread Mayank Acharya
Dear all,
I am new to Go language.

I searched a lot to understand it's paradigm structure but still not 
getting clear idea about that.

Please if anyone can explain, go language follows which programming 
paradigm with some clear example for understanding.

I really appreciate responses.

Thank you.

-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: [Ann] Generating go struct from json/yaml

2017-07-16 Thread Aditya Mukerjee
Hi Tong,

Glad to see you're finding gojson useful. Let us know if you have 
suggestions; if there are improvements which would be helpful for people in 
general, we'd be happy to merge them upstream.


On Sunday, July 16, 2017 at 10:28:09 AM UTC-4, Tong Sun wrote:
>
> Hi, 
>
> I've started to improve the tools that generates go struct definitions 
> from json or yaml documents,
> https://github.com/go-jsonfile/gojson#cli-update:
>
> Using gojson is now deprecated. You can still install and use it, but 
> better use jsonfiddle j2s 
>  instead, 
> because all the improvements will be happening there. Currently the 
> advantages of jsonfiddle j2s over gojson are:
>
>
>- No longer uses the dummy Foo as the default for the name of the 
>   struct now, but use the input file name to automatic set the struct 
> name 
>   instead, yet it can be overridden from command line (by --name). Check 
>   the details here 
>   
>   .
>   - Internally, much more code consolidation and simplification 
>   (e.g., input/output file handling) have been done under the hood, so 
> the 
>   hand-edited code has been reduced from over a hundred (132) to just 
>   several lines 
>   
>   .
>
> Much more enhancements will be taken place, check out details here 
> .
>
>
>
> See also, https://github.com/go-jsonfile/jsonfiddle#credits, 
>
> Credits
>
>
>- Ladicle/gojson  forked source for 
>   JSON to struct
>   - ChimeraCoder/gojson  the 
>   original source of Ladicle/gojson 
>   .
>
>
> All patches welcome.
>
> Thanks
>
>

-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] json.Unmarshal and numbers: go 1.7 vs go 1.8

2017-07-16 Thread Traun Leyden

Ok thanks!

Btw looks like the copy/paste turned 2^64 -> 264 

On Saturday, July 15, 2017 at 11:34:18 AM UTC-7, Ian Lance Taylor wrote:
>
> On Sat, Jul 15, 2017 at 11:20 AM, Traun Leyden  > wrote: 
> > 
> > On go 1.7, I'm seeing a difference in behavior between json.Unmarshal 
> and 
> > json.Decoder when it comes to json numbers. 
> > 
> > This test program which compares json.Unmarshal() vs. json.NewDecoder() 
> > behavior w.r.t to numbers works fine on go 1.8, but if I run it against 
> go 
> > 1.7 on OSX I get this error: 
> > 
> > $ go run main.go 
> > 2017/07/15 11:19:15 json.Unmarshal() + json.Marshal(): { 
> > "Doc": { 
> > "GithubUsers": [ 
> > { 
> > "id": 3.411441e+06, 
> > "type": "User" 
> > } 
> > ], 
> > "_id": "github_users_default" 
> > } 
> > } 
> > 2017/07/15 11:19:15 The id field was changed to floating point format 
> > 2017/07/15 11:19:15 Couldn't unmarshal into github user object: json: 
> cannot 
> > unmarshal number 3.411441e+06 into Go value of type int 
> > 2017/07/15 11:19:15 json.Decode() + json.Marshal(): { 
> > "Doc": { 
> > "GithubUsers": [ 
> > { 
> > "id": 3411441, 
> > "type": "User" 
> > } 
> > ], 
> > "_id": "github_users_default" 
> > } 
> > } 
> > 
> > 
> > I'm going to update to Go 1.8 and forget about it, but out of curiosity 
> does 
> > anyone know if it was intentional change in Go 1.8? 
>
> Yes.  Look for encoding/json under 
> https://golang.org/doc/go1.8#minor_library_changes . 
>
> "Marshal encodes floating-point numbers using the same format as in 
> ES6, preferring decimal (not exponential) notation for a wider range 
> of values. In particular, all floating-point integers up to 264 format 
> the same as the equivalent int64 representation." 
>
> Ian 
>

-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Can't explain Golang benchmarks

2017-07-16 Thread Zohaib Sibte Hassan
Thanks for pointing issues out I updated my code to get rid of race 
conditions (nothing critical I was always doing reader-writer race). Anyhow 
I updated my code on 
https://gist.github.com/maxpert/f3c405c516ba2d4c8aa8b0695e0e054e. Still 
doesn't explain the new results:

$> go test -race -run=! -bench=. -benchmem -cpu=1,2,4,8 -cpuprofile=cpu.out 
-memprofile=mem.out pubsub_test.go
BenchmarkPubSubPrimitiveChannelsMultiple  50  21121694 ns/op   
 8515 B/op  39 allocs/op
BenchmarkPubSubPrimitiveChannelsMultiple-2   100  19302372 ns/op   
 4277 B/op  20 allocs/op
BenchmarkPubSubPrimitiveChannelsMultiple-450  22674769 ns/op   
 8182 B/op  35 allocs/op
BenchmarkPubSubPrimitiveChannelsMultiple-850  21201533 ns/op   
 8469 B/op  38 allocs/op
BenchmarkPubSubWaitGroupMultiple3000501804 ns/op 
 63 B/op   2 allocs/op
BenchmarkPubSubWaitGroupMultiple-2   200  15417944 ns/op 
407 B/op   6 allocs/op
BenchmarkPubSubWaitGroupMultiple-4   300   5010273 ns/op 
231 B/op   4 allocs/op
BenchmarkPubSubWaitGroupMultiple-8   200   5444634 ns/op 
334 B/op   5 allocs/op
PASS
ok   command-line-arguments 21.775s

So far my testing shows channels are slower for pubsub scenario. I tried 
looking into pprof dumps of memory and CPU and it's not making sense to me. 
What am I missing here?

On Sunday, July 16, 2017 at 10:27:04 AM UTC-7, peterGo wrote:
>
> When you have data races the results are undefined.
>
> $ go version
> go version devel +dd81c37 Sat Jul 15 05:43:45 2017 + linux/amd64
> $ go test -race -run=! -bench=. -benchmem -cpu=1,2,4,8 pubsub_test.go
> ==
> WARNING: DATA RACE
> Read at 0x00c4200140c0 by goroutine 18:
>   command-line-arguments.BenchmarkPubSubPrimitiveChannelsMultiple()
>   /home/peter/gopath/src/nuts/pubsub_test.go:59 +0x51d
>   testing.(*B).runN()
>   /home/peter/go/src/testing/benchmark.go:141 +0x12a
>   testing.(*B).run1.func1()
>   /home/peter/go/src/testing/benchmark.go:214 +0x6b
>
> Previous write at 0x00c4200140c0 by goroutine 57:
>   [failed to restore the stack]
>
> Goroutine 18 (running) created at:
>   testing.(*B).run1()
>   /home/peter/go/src/testing/benchmark.go:207 +0x8c
>   testing.(*B).Run()
>   /home/peter/go/src/testing/benchmark.go:513 +0x482
>   testing.runBenchmarks.func1()
>   /home/peter/go/src/testing/benchmark.go:417 +0xa7
>   testing.(*B).runN()
>   /home/peter/go/src/testing/benchmark.go:141 +0x12a
>   testing.runBenchmarks()
>   /home/peter/go/src/testing/benchmark.go:423 +0x86d
>   testing.(*M).Run()
>   /home/peter/go/src/testing/testing.go:928 +0x51e
>   main.main()
>   command-line-arguments/_test/_testmain.go:46 +0x1d3
>
> Goroutine 57 (finished) created at:
>   command-line-arguments.BenchmarkPubSubPrimitiveChannelsMultiple()
>   /home/peter/gopath/src/nuts/pubsub_test.go:40 +0x290
>   testing.(*B).runN()
>   /home/peter/go/src/testing/benchmark.go:141 +0x12a
>   testing.(*B).run1.func1()
>   /home/peter/go/src/testing/benchmark.go:214 +0x6b
> ==
> --- FAIL: BenchmarkPubSubPrimitiveChannelsMultiple
> benchmark.go:147: race detected during execution of benchmark
> ==
> WARNING: DATA RACE
> Read at 0x00c42000c030 by goroutine 1079:
>   command-line-arguments.BenchmarkPubSubWaitGroupMultiple.func1()
>   /home/peter/gopath/src/nuts/pubsub_test.go:76 +0x9e
>
> Previous write at 0x00c42000c030 by goroutine 7:
>   command-line-arguments.BenchmarkPubSubWaitGroupMultiple()
>   /home/peter/gopath/src/nuts/pubsub_test.go:101 +0x475
>   testing.(*B).runN()
>   /home/peter/go/src/testing/benchmark.go:141 +0x12a
>   testing.(*B).run1.func1()
>   /home/peter/go/src/testing/benchmark.go:214 +0x6b
>
> Goroutine 1079 (running) created at:
>   command-line-arguments.BenchmarkPubSubWaitGroupMultiple()
>   /home/peter/gopath/src/nuts/pubsub_test.go:93 +0x2e6
>   testing.(*B).runN()
>   /home/peter/go/src/testing/benchmark.go:141 +0x12a
>   testing.(*B).run1.func1()
>   /home/peter/go/src/testing/benchmark.go:214 +0x6b
>
> Goroutine 7 (running) created at:
>   testing.(*B).run1()
>   /home/peter/go/src/testing/benchmark.go:207 +0x8c
>   testing.(*B).Run()
>   /home/peter/go/src/testing/benchmark.go:513 +0x482
>   testing.runBenchmarks.func1()
>   /home/peter/go/src/testing/benchmark.go:417 +0xa7
>   testing.(*B).runN()
>   /home/peter/go/src/testing/benchmark.go:141 +0x12a
>   testing.runBenchmarks()
>   /home/peter/go/src/testing/benchmark.go:423 +0x86d
>   testing.(*M).Run()
>   /home/peter/go/src/testing/testing.go:928 +0x51e
>   main.main()
>   command-line-arguments/_test/_testmain.go:46 +0x1d3
> ==
> ==
> WARNING: DATA RACE
> Write at 0x00c42000c030 by goroutine 7:
>   command-line-arguments.BenchmarkPubSubWaitGroupMultiple()
>   

Re: [go-nuts] Re: Named or unnamed struct initialisation? What is best practice?

2017-07-16 Thread Dan Kortschak
Yes, trailing zero-size elements affect the size.

https://play.golang.org/p/Ox0FJX3C5V

https://github.com/golang/go/commit/6f07ac2f280847ee0346b871b23cab90869f84a4

On Tue, 2017-07-11 at 20:34 -0700, Rader wrote:
> I found the position of `[0]byte` in the struct matters. 
>  type bar2 struct {
> A int
> _ [0]byte
> }
> 
> differs from
> 
> type bar3 struct {
> _ [0]byte
> A int 
> }
> 

-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Re: Named or unnamed struct initialisation? What is best practice?

2017-07-16 Thread Dan Kortschak
Both are used.

On Wed, 2017-07-12 at 11:43 +, Matthew Zimmerman wrote:
> Why not use struct{}?  Is what is recommended for maps to notate a
> set
> (only the keys mean something).



-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Shiny

2017-07-16 Thread Ged Wed
have a look here:

https://docs.google.com/document/d/1mXev7TyEnvM4t33lnqoji-x7EqGByzh4RpE4OqEZck4/edit#

-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


[go-nuts] Re: Can't explain Golang benchmarks

2017-07-16 Thread peterGo
When you have data races the results are undefined.

$ go version
go version devel +dd81c37 Sat Jul 15 05:43:45 2017 + linux/amd64
$ go test -race -run=! -bench=. -benchmem -cpu=1,2,4,8 pubsub_test.go
==
WARNING: DATA RACE
Read at 0x00c4200140c0 by goroutine 18:
  command-line-arguments.BenchmarkPubSubPrimitiveChannelsMultiple()
  /home/peter/gopath/src/nuts/pubsub_test.go:59 +0x51d
  testing.(*B).runN()
  /home/peter/go/src/testing/benchmark.go:141 +0x12a
  testing.(*B).run1.func1()
  /home/peter/go/src/testing/benchmark.go:214 +0x6b

Previous write at 0x00c4200140c0 by goroutine 57:
  [failed to restore the stack]

Goroutine 18 (running) created at:
  testing.(*B).run1()
  /home/peter/go/src/testing/benchmark.go:207 +0x8c
  testing.(*B).Run()
  /home/peter/go/src/testing/benchmark.go:513 +0x482
  testing.runBenchmarks.func1()
  /home/peter/go/src/testing/benchmark.go:417 +0xa7
  testing.(*B).runN()
  /home/peter/go/src/testing/benchmark.go:141 +0x12a
  testing.runBenchmarks()
  /home/peter/go/src/testing/benchmark.go:423 +0x86d
  testing.(*M).Run()
  /home/peter/go/src/testing/testing.go:928 +0x51e
  main.main()
  command-line-arguments/_test/_testmain.go:46 +0x1d3

Goroutine 57 (finished) created at:
  command-line-arguments.BenchmarkPubSubPrimitiveChannelsMultiple()
  /home/peter/gopath/src/nuts/pubsub_test.go:40 +0x290
  testing.(*B).runN()
  /home/peter/go/src/testing/benchmark.go:141 +0x12a
  testing.(*B).run1.func1()
  /home/peter/go/src/testing/benchmark.go:214 +0x6b
==
--- FAIL: BenchmarkPubSubPrimitiveChannelsMultiple
benchmark.go:147: race detected during execution of benchmark
==
WARNING: DATA RACE
Read at 0x00c42000c030 by goroutine 1079:
  command-line-arguments.BenchmarkPubSubWaitGroupMultiple.func1()
  /home/peter/gopath/src/nuts/pubsub_test.go:76 +0x9e

Previous write at 0x00c42000c030 by goroutine 7:
  command-line-arguments.BenchmarkPubSubWaitGroupMultiple()
  /home/peter/gopath/src/nuts/pubsub_test.go:101 +0x475
  testing.(*B).runN()
  /home/peter/go/src/testing/benchmark.go:141 +0x12a
  testing.(*B).run1.func1()
  /home/peter/go/src/testing/benchmark.go:214 +0x6b

Goroutine 1079 (running) created at:
  command-line-arguments.BenchmarkPubSubWaitGroupMultiple()
  /home/peter/gopath/src/nuts/pubsub_test.go:93 +0x2e6
  testing.(*B).runN()
  /home/peter/go/src/testing/benchmark.go:141 +0x12a
  testing.(*B).run1.func1()
  /home/peter/go/src/testing/benchmark.go:214 +0x6b

Goroutine 7 (running) created at:
  testing.(*B).run1()
  /home/peter/go/src/testing/benchmark.go:207 +0x8c
  testing.(*B).Run()
  /home/peter/go/src/testing/benchmark.go:513 +0x482
  testing.runBenchmarks.func1()
  /home/peter/go/src/testing/benchmark.go:417 +0xa7
  testing.(*B).runN()
  /home/peter/go/src/testing/benchmark.go:141 +0x12a
  testing.runBenchmarks()
  /home/peter/go/src/testing/benchmark.go:423 +0x86d
  testing.(*M).Run()
  /home/peter/go/src/testing/testing.go:928 +0x51e
  main.main()
  command-line-arguments/_test/_testmain.go:46 +0x1d3
==
==
WARNING: DATA RACE
Write at 0x00c42000c030 by goroutine 7:
  command-line-arguments.BenchmarkPubSubWaitGroupMultiple()
  /home/peter/gopath/src/nuts/pubsub_test.go:101 +0x475
  testing.(*B).runN()
  /home/peter/go/src/testing/benchmark.go:141 +0x12a
  testing.(*B).run1.func1()
  /home/peter/go/src/testing/benchmark.go:214 +0x6b

Previous read at 0x00c42000c030 by goroutine 1078:
  command-line-arguments.BenchmarkPubSubWaitGroupMultiple.func1()
  /home/peter/gopath/src/nuts/pubsub_test.go:76 +0x9e

Goroutine 7 (running) created at:
  testing.(*B).run1()
  /home/peter/go/src/testing/benchmark.go:207 +0x8c
  testing.(*B).Run()
  /home/peter/go/src/testing/benchmark.go:513 +0x482
  testing.runBenchmarks.func1()
  /home/peter/go/src/testing/benchmark.go:417 +0xa7
  testing.(*B).runN()
  /home/peter/go/src/testing/benchmark.go:141 +0x12a
  testing.runBenchmarks()
  /home/peter/go/src/testing/benchmark.go:423 +0x86d
  testing.(*M).Run()
  /home/peter/go/src/testing/testing.go:928 +0x51e
  main.main()
  command-line-arguments/_test/_testmain.go:46 +0x1d3

Goroutine 1078 (running) created at:
  command-line-arguments.BenchmarkPubSubWaitGroupMultiple()
  /home/peter/gopath/src/nuts/pubsub_test.go:93 +0x2e6
  testing.(*B).runN()
  /home/peter/go/src/testing/benchmark.go:141 +0x12a
  testing.(*B).run1.func1()
  /home/peter/go/src/testing/benchmark.go:214 +0x6b
==
==
WARNING: DATA RACE
Read at 0x00c4200140c8 by goroutine 7:
  command-line-arguments.BenchmarkPubSubWaitGroupMultiple()
  /home/peter/gopath/src/nuts/pubsub_test.go:109 +0x51d
  testing.(*B).runN()
  /home/peter/go/src/testing/benchmark.go:141 +0x12a
  testing.(*B).run1.func1()
  /home/peter/go/src/testing/benchmark.go:214 +0x6b

[go-nuts] [Ann] Generating go struct from json/yaml

2017-07-16 Thread Tong Sun
Hi, 

I've started to improve the tools that generates go struct definitions from 
json or yaml documents,
https://github.com/go-jsonfile/gojson#cli-update:

Using gojson is now deprecated. You can still install and use it, but 
better use jsonfiddle j2s 
 instead, 
because all the improvements will be happening there. Currently the 
advantages of jsonfiddle j2s over gojson are:


   - No longer uses the dummy Foo as the default for the name of the struct 
  now, but use the input file name to automatic set the struct name 
instead, 
  yet it can be overridden from command line (by --name). Check the 
  details here 
  
  .
  - Internally, much more code consolidation and simplification (e.g., 
  input/output file handling) have been done under the hood, so the 
  hand-edited code has been reduced from over a hundred (132) to just 
  several lines 
  
  .
   
Much more enhancements will be taken place, check out details here 
.



See also, https://github.com/go-jsonfile/jsonfiddle#credits, 

Credits


   - Ladicle/gojson  forked source for 
  JSON to struct
  - ChimeraCoder/gojson  the 
  original source of Ladicle/gojson .
   

All patches welcome.

Thanks

-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Shiny

2017-07-16 Thread Elias Naur
Hi,

I had plans to work on a GUI library that follows many of the design 
choices from Flutter. In particular, I'd like to experiment with immediate 
mode drawing and a layout manager based on Cassowary. As backend I plan to 
avoid too much upfront work and bind to Skia. I'd be very interested in 
your approach as well.

 - elias

On Sunday, July 16, 2017 at 1:24:37 PM UTC+2, Joe Blue wrote:
>
> Hey
>
> All gophers that want a GUI toolkit... 
> We are doing a bring up that is planned to work on all desktops, mobile 
> and embedded.
>
> Support the following app types:: 
> forms, 2d surface and 3d surface.
>
> Will have:
> Material design components, virtual keyboard, cut and paste, audio and 
> video capture and playback.
> Intimate gesture control and keyboard mapping.
> Printing via pdf
>
> We are right now working out if we use OpenGL or Vulkan.
> Also the best immutable data binding approach.
>
> Then the long work on building pixel perfect material design conformance 
> with CI testing of it.
>
> If you interested in forging the approach or have ideas please ping me. 
> The system is not ready for general usage yet so it's better if people that 
> have some golang open GL experience ping me so we can make sure the design 
> covers / considers your needs.
>
> Joeblew99 at Gmail dot com.
>
>

-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Web UI library in pure Go?

2017-07-16 Thread Mandolyte
https://github.com/gopherjs/gopherjs

On Saturday, July 15, 2017 at 5:16:34 PM UTC-4, ohir wrote:
>
> On Sat, 15 Jul 2017 09:30:39 -0700 (PDT) 
> Leff Ivanov  wrote: 
>
> > Is there something like Vaadin, GWT, ZK in Golang world? I mean 
> something 
> > to do web UIs in pure Go without the need to write JavaScript and HTML. 
> > 
>
> https://github.com/icza/gowut GPL3 
> https://github.com/gu-io/gu MIT 
>
>

-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [go-nuts] Shiny

2017-07-16 Thread Joe Blue
Hey

All gophers that want a GUI toolkit... 
We are doing a bring up that is planned to work on all desktops, mobile and 
embedded.

Support the following app types:: 
forms, 2d surface and 3d surface.

Will have:
Material design components, virtual keyboard, cut and paste, audio and video 
capture and playback.
Intimate gesture control and keyboard mapping.
Printing via pdf

We are right now working out if we use OpenGL or Vulkan.
Also the best immutable data binding approach.

Then the long work on building pixel perfect material design conformance with 
CI testing of it.

If you interested in forging the approach or have ideas please ping me. The 
system is not ready for general usage yet so it's better if people that have 
some golang open GL experience ping me so we can make sure the design covers / 
considers your needs.

Joeblew99 at Gmail dot com.

-- 
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...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.