Re: [go-nuts] Re: Upcoming Go protobuf release

2018-05-05 Thread Tharaneedharan Vilwanathan
Hi Joe, Thats, great to know! Thanks!! Regards dharani On Fri, May 4, 2018 at 10:40 AM Joe Tsai wrote: > The merge has happened on pull request #591 > . > > JT > > On Thu, May 3, 2018 at 4:01 PM Tharaneedharan Vilwanathan < > vdhar...@gmail.com> wr

Re: [go-nuts] An issue with the select statement.

2018-05-05 Thread Andriy Pylypenko
2018-05-04 21:31 GMT+03:00 Ian Lance Taylor : > On Fri, May 4, 2018 at 11:10 AM, Andriy Pylypenko > wrote: > > > > In fact I have that guarantee because the supplier thread is a single > > goroutine and it guarantees that there would be no items on the work_ch > > after the idle state is requeste

Re: [go-nuts] An issue with the select statement.

2018-05-05 Thread Andriy Pylypenko
2018-05-05 11:11 GMT+03:00 Andriy Pylypenko : > I'll note in passing that pools of goroutines are not the best idiom >> for Go. Starting new goroutines is cheap. It's generally simpler to >> spin up goroutines as needed then to keep a pool of goroutines around. >> In this model use a separate se

[go-nuts] Re: Go routines hanging

2018-05-05 Thread sam
Please find my code here , the playground won't run the code because of it's dependencies, but the issue may well be to do with these dependencies so I thought I'd better not remove them from the example. On Friday, May 4, 2018 at 5:09:17 PM UTC+1, Aaron A

[go-nuts] Re: Go routines hanging

2018-05-05 Thread sam
Thanks for the tip! I tested this out, and all go routines are stopping, I ran a go routine with a non conditional for loop with a print and a sleep of 1 second, and this only ran twice, then nothing! How did you get around this? On Saturday, May 5, 2018 at 12:31:41 AM UTC+1, Michael Andersen w

[go-nuts] Re: Go routines hanging

2018-05-05 Thread sam
debug.SetGCPercent(-1) stops the issue occurring - so I think we're onto a winner with the garbage collection idea! Is there something I'm doing wrong that is causing this GC binning off all of my go routines? Is there a way to avoid this, I'd obviously rather not turn off GC entirely. On Fri

[go-nuts] Re: Go routines hanging

2018-05-05 Thread James Bardin
On Saturday, May 5, 2018 at 6:27:54 AM UTC-4, s...@whites.team wrote: > > debug.SetGCPercent(-1) > stops the issue occurring - so I think we're onto a winner with the > garbage collection idea! Is there something I'm doing wrong that is causing > this GC binning off all of my go routines? >

[go-nuts] Re: Go routines hanging

2018-05-05 Thread sam
Hi James, Thanks for the tip - could you elaborate on your idea of a 'busy loop'? Is this a loop that is blocked, or just one that is currently operating on something? I'm not sure what causes GC to act on certain go routines. I completely understand that getting the length of the channel isn't

[go-nuts] Re: Go routines hanging

2018-05-05 Thread James Bardin
On Saturday, May 5, 2018 at 9:30:25 AM UTC-4, s...@whites.team wrote: > > Hi James, > > Thanks for the tip - could you elaborate on your idea of a 'busy loop'? Is > this a loop that is blocked, or just one that is currently operating on > something? I'm not sure what causes GC to act on certain

Re: [go-nuts] Implementing method overloading using first class functions

2018-05-05 Thread matthewjuran
> > I sorta only vaguely understand what you mean about being 'too big'. I’m being vague and I haven’t read this thread in detail besides seeing type B in the first email. I plan to read it in detail and send another response. I’m speaking from the idea behind a version of this story: http://

Re: [go-nuts] Re: [ANN] GoKi Trees and GoGi GUI

2018-05-05 Thread matthewjuran
In a generic container I would expect to see items typed as interface{} and the behavior defined on a slice of interface{} or struct with private slice of interface{} field. >From the godoc it looks like type Node implements type Ki, and there’s no other type that implements Ki. I don’t underst

Re: [go-nuts] Implementing method overloading using first class functions

2018-05-05 Thread Louki Sumirniy
Indeed, I am not a fan of overengineering either. But the rules of data structure largely expounded by Knuth and others a long time ago were in the context of an entirely different hardware architecture to what we have today. CPUs didn't even have caches until late in the 16 bit era. The caches

[go-nuts] Re: Go routines hanging

2018-05-05 Thread sam
I see your point! Line 46 would never be in production, that was just to return for the specific situation I was testing, but the other loop would make more sense using sync. I'll take a look into sync functionality as I've not used it before, but that seems like the idiomatic way to do it! Than

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

2018-05-05 Thread Paul Hankin
On Friday, 27 April 2018 23:57:42 UTC+2, Michael Jones wrote: > > Yuval, > > There are fundamental issues here. > > 1. That equation (de Moivre, Binet) is from the algebra of ideal numbers. > Numbers of infinite precision. Not the realm of computer arithmetic. It > works fine with double precisio

Re: [go-nuts] I don't know about callbacks in Golang

2018-05-05 Thread Justin Israel
Can you explain what problem you actually want to solve by learning about callbacks? Maybe there is a better learning reference to offer you based on your actual goals. Justin On Sat, May 5, 2018, 12:52 PM Eduardo Moseis Fuentes wrote: > HI everyone I´m Eduardo from Guatemala and I'm beginer.

[go-nuts] go 1 on Ubuntu 18.04

2018-05-05 Thread rob
I have a question regarding file locations for go on Ubuntu.  I just installed Ubuntu 18.04 and installed go 1.10.1 thru the package manager.  That puts the go system in /usr/bin. The instructions on the golang site when installing an updated version of go, like version 1.10.2, says to install

[go-nuts] globals defined by stringer utility

2018-05-05 Thread naha
I just learned about the stringer utility from Rob Pike's atricle about generate (https://blog.golang.org/generate). I was wondering why the code generated by stringer has it's data in global variables (example from the article) const _Pill_name = "PlaceboAspirinIbuprofenParacetamol" var _Pill

Re: [go-nuts] go 1 on Ubuntu 18.04

2018-05-05 Thread Philip Chapman
Since you installed it through the package management system rather than manually, it would be best to wait for new versions of go be packaged and provided through the same package management system. Should you want to do otherwise, it would be best to uninstall the go package using apt-get and th

[go-nuts] Re: fallthrough for select

2018-05-05 Thread sim . chevrier
Hi, I know this is kind of old and I'm not sure anyone will answer, but even after the previous discussion I feel like any kind of switch-like statements should be able to fallthrough. The answer that it doesn't make sense because you're supposed to choose between different available channel op

[go-nuts] How to fake os.Stdout in golang for testing?

2018-05-05 Thread mfriedenhagen
Hello, I am trying out golang and like it's concepts (coming from Python and Java mostly, not having Exceptions felt a bit strange at the start, though :-)). * Now I try to write tests for https://github.com/caradojo/trivia/blob/master/go/trivia.go for the fun of it. * I want to do this witho

[go-nuts] [reflect] the type of the return value from reflect.Value.Call() is different

2018-05-05 Thread yarencheng
I found that 1. If a function returns interface{} 2. Try to invoke it through reflect.Value.Call() 3. The type of return value will be a pointer For example: (https://play.golang.org/p/gyimxUzUVYf) package main import ( "fmt" "reflect" ) type MyStruct struct{} func (my *MyStruct) Fn()

Re: [go-nuts] How to fake os.Stdout in golang for testing?

2018-05-05 Thread Lars Seipel
On Sat, May 05, 2018 at 08:55:17AM -0700, mfriedenha...@gmail.com wrote: > * Now in golang `os.Stdout` is an `*os.File` which is mostly a wrapper for > an OS specific file. You can always use os.Pipe to get an actual file descriptor to write to. -- You received this message because you are sub

[go-nuts] I don't know about callbacks in Golang

2018-05-05 Thread Sokolov Yura
Callbacks are rarely used in Go's ecosystem. Most of time you will use callbacks only in your own libraries (if you put them in). Unnamed functions are as simole as `callIt(func (arg Type, arg2 Type2) (res1 Type, res2 Type) { res1, res2 = body(); return res1, res2}) ` -- You received this messa

Re: [go-nuts] How to fake os.Stdout in golang for testing?

2018-05-05 Thread alex . rou . sg
Or use log instead of fmt var stdout = log.New(os.Stdout, "", 0) Then you can easily redirect it to any io.Writter like buf := &strings.Builder{} stdout = log.New(buf, "", 0) On Sunday, 6 May 2018 13:32:47 UTC+8, Lars Seipel wrote: > > On Sat, May 05, 2018 at 08:55:17AM -0700, mfried...@gmail

Re: [go-nuts] Possible issue with math.Floor on Linux

2018-05-05 Thread Andrei Avram
Indeed, it was about precision, the issue is with Windows, not with Go. I've used only one time.Now call and the planets have aligned. package main import ( "time" "math" "fmt" ) func main() { now := time.Now() datetime := now.Add(time.Hour * 24 * 7 * 4 * 12 * 3) seconds := -1 * int(now.Sub(da

Re: [go-nuts] I don't know about callbacks in Golang

2018-05-05 Thread Justin Israel
Callbacks are not something that is considered a standard aspect to Go programming, in the same sense as you might see them in something like js/Node.js async programming. The fact that you mentioned Web programming explains why you might have been exposed to the concept, when it is describing your