[go-nuts] Re: On Accepting Interfaces and Structs

2018-04-26 Thread jake6502
The example gives me a better understanding of what you are doing, though still not much understanding as to *why *you are doing it this way. Usually, if I feel that code has a "smell" in Go, there is a way to rethink the basic design resulting more "natural" code. But without a full

Re: [go-nuts] FR: godoc have Methods collapsed by default

2018-04-26 Thread Dan Kortschak
I like being able to look for methods, so I would be sad to see this as the default behaviour. On Thu, 2018-04-26 at 16:00 -0700, swufy via golang-nuts wrote: > Are there any counter-arguments for why we wouldn't want this for the > docs? -- You received this message because you are subscribed

[go-nuts] Re: Calling sync.WaitGroup.Add() while a sync.WaitGroup.Wait() is waiting

2018-04-26 Thread David Collier-Brown
I also ran into a race diagnostic when I did an "Add" after my main programs started "Wait"ing: I moved the add to the main program and cured it. I read this as the WaitGroup being careful and efficient about use of locking primitives, and not liking the expensive operation of incrementing a

[go-nuts] Re: Calling sync.WaitGroup.Add() while a sync.WaitGroup.Wait() is waiting

2018-04-26 Thread David Collier-Brown
I also ran into a race diagnostic when I did and Add after my main programs started Waiting: I move the add to the main program and cured it. I read this as the WaitGroup being careful and efficient about use of locking primitives, and not liking the expensive operation of incrementing a

[go-nuts] FR: godoc have Methods collapsed by default

2018-04-26 Thread swufy via golang-nuts
Feature Request - Have methods for structs to be collapsed by default (with an arrow next to the type def to reveal them) in the Index section of godocs. Reasoning: Some packages include multiple structs with methods. For example, https://golang.org/pkg/math/big/ has Accuracy, ErrNaN, Float,

[go-nuts] Article: Go for art

2018-04-26 Thread matthewjuran
Hello, Here’s an article I’ve written about Go: https://github.com/pciet/goforart “Go for art. An article about the Go programming language and greater professional software community.” I wrote this today but there is a lot of research built into it. There is discussion about religion, and

[go-nuts] Re: Calling sync.WaitGroup.Add() while a sync.WaitGroup.Wait() is waiting

2018-04-26 Thread deleplace2015
Hello Jon I think this is working as expected. The relevant part of the doc is "calls with a positive delta that start when the counter is greater than zero, may happen at any time". This is what happens in your code (stdout on the left, my comments on the right) * here wg is

Re: [go-nuts] Calling sync.WaitGroup.Add() while a sync.WaitGroup.Wait() is waiting

2018-04-26 Thread Ian Lance Taylor
On Thu, Apr 26, 2018 at 8:29 AM, Jon Bodner wrote: > > We were having a discussion at work about passing around references to > sync.WaitGroup. I said it was a bad idea, because if a goroutine launched a > goroutine of its own and called sync.WaitGroup.Add() after a

Re: [go-nuts] float accuracy when calculating Fibonacci numbers

2018-04-26 Thread Ian Lance Taylor
On Thu, Apr 26, 2018 at 1:17 AM, Yuval Lifshitz wrote: > > I ran into the following issue when started playing with go. Had the > following small program to calculate Fibonacci numbers using the closed > form: > > package "fib" > > import "math" > > var sqrt_5 = math.Sqrt(5.0)

Re: [go-nuts] How does time reported by go test relate to the wall clock time?

2018-04-26 Thread Jan Mercl
time reports build+test time, but go test reports only test time. On Thu, Apr 26, 2018, 18:54 Prateek Rungta wrote: > I've noticed weird discrepancies in the time reported by `go test > `, and the elapsed wall clock time. > > For example: > > ❯ time go test ./client > ok

[go-nuts] Re: Using variadic function / context in an interface?

2018-04-26 Thread 'simon place' via golang-nuts
does the init NEED to be in the interface? On Thursday, 26 April 2018 17:55:07 UTC+1, Nimrod Shneor wrote: > > Hey everyone, > I've encountered a design issue - > I have an the following interface - > > type Runner interface { > Run(x X,y Y) > } > > I want to add to it an Init(...) method

[go-nuts] How does time reported by go test relate to the wall clock time?

2018-04-26 Thread Prateek Rungta
I've noticed weird discrepancies in the time reported by `go test `, and the elapsed wall clock time. For example: ❯ time go test ./client ok github.com/m3db/m3db/client *11.717s* /Users/prungta/code/go1.9.2/bin/go test ./client *10.54s* user 1.58s system 74% cpu 16.233 total ❯ time go

[go-nuts] Re: Is there anyone using gomobile in production ?

2018-04-26 Thread kevthemusician
Could you explain what you mean by just passing binary data? I am currently trying to build an SDK using Golang mobile, and it's a bit frustrating with all of the binding issues Thanks, Kev On Saturday, 10 March 2018 20:10:01 UTC, Ged Wed wrote: > > Some large logging and metrics companies

[go-nuts] float accuracy when calculating Fibonacci numbers

2018-04-26 Thread Yuval Lifshitz
Dear community, I ran into the following issue when started playing with go. Had the following small program to calculate Fibonacci numbers using the closed form: package "fib" import "math" var sqrt_5 = math.Sqrt(5.0) var psi = -1.0/math.Phi // had to add this to solve accuracy issue func

[go-nuts] Using variadic function / context in an interface?

2018-04-26 Thread nimrodshn
Hey everyone, I've encountered a design issue - I have an the following interface - type Runner interface { Run(x X,y Y) } I want to add to it an Init(...) method which will initialize the internal fields of the Runner before performing `Run`.. My issue is that different structs implementing

[go-nuts] Re: Extension for type assertion of interface array

2018-04-26 Thread 'simon place' via golang-nuts
i too didn't like this, although i get the reasons for it. but for me these are unaddressed points; 1. the language does not distinguish array types, as a group, in any way, except here. 2. you can have many types that simultaneously implement multiple interfaces, for these you need copying

[go-nuts] Calling sync.WaitGroup.Add() while a sync.WaitGroup.Wait() is waiting

2018-04-26 Thread Jon Bodner
Hello, We were having a discussion at work about passing around references to sync.WaitGroup. I said it was a bad idea, because if a goroutine launched a goroutine of its own and called sync.WaitGroup.Add() after a goroutine called sync.WaitGroup.Wait(), but before the count dropped to 0, your

Re: [go-nuts] Extension for type assertion of interface array

2018-04-26 Thread Alex Efros
Hi! On Sun, Apr 22, 2018 at 09:48:13PM -0700, nsakth...@gmail.com wrote: > this pattern requires a language level change to avoid unwanted array copy [...] > but shouldn't the language provide an extension to already available syntax The language is trying to avoid hiding performance-critical

[go-nuts] [ANN] A utility lib make it easy to write gnatsd proxy and middlewares

2018-04-26 Thread antmanler
gnatsd-gw https://github.com/antmanler/gnatsd-gw A utility lib make it easy to write gnatsd proxy and middlewares It uses the same code as gnatsd to parse protocol, can inspect most commands. Features: - Leverage the official zero-alloc parser to