[go-nuts] Re: What's the status/roadmap of geo/s2 library?

2021-01-28 Thread Markus Heukelom
I think your question is answered by s2/geo github page itself (https://github.com/golang/geo): " *In Progress* Files that have some work done, but are probably not complete enough for general use in production code. - CellIndex - A queryable index of CellIDs. etc On Tuesday, January 2

Re: [go-nuts] What compatibility of go/ast, go/types, go/packages packages is planned, if any, when transitioning toward go2 ?

2021-01-28 Thread 'Carla Pfaff' via golang-nuts
On Wednesday, 27 January 2021 at 23:28:17 UTC+1 Ian Lance Taylor wrote: > To be clear, there is no Go 2, and there are no plans for Go 2. > For someone who follows the mailing lists and issue comments this has been known for a while, but it's easy to see where the confusion comes from, given t

[go-nuts] Options other than pointers, regarding code duplication

2021-01-28 Thread Kevin Chadwick
I have three logging functions that are almost identical. If I move the identicle code into a function without pointers then there is a noticeable speed decrease. I know this is premature optimisation as logging shouldn't happen frequently enough or be that large (hopefully). That said. I am left

[go-nuts] Go 1.16 Release Candidate 1 is released

2021-01-28 Thread Alex Rakoczy
Hello gophers, We have just released go1.16rc1, a release candidate version of Go 1.16. It is cut from release-branch.go1.16 at the revision tagged go1.16rc1. Please try your production load tests and unit tests with the new version. Your help testing these pre-release versions is invaluable. Re

[go-nuts] Re: Options other than pointers, regarding code duplication

2021-01-28 Thread jake...@gmail.com
Perhaps providing some code could be helpful. That way we can better understand what the issues are. Minimally the function signatures you have now, and the signature of common function you are calling inside them, as well as the definitions of any types being passes. Of course, the full code

Re: [go-nuts] Code coverage in error cases when compared to other languages

2021-01-28 Thread Szczepan Faber
Good question and useful discussion! What is Go community guidance on the _value_ of unit testing the `if err i= nil { return err }` idiom? To make the question a little more precise, let's consider the code snippet in the first email in this thread. Let's assume that I already have coverage f

[go-nuts] calling cmd

2021-01-28 Thread Jeff Mangan
I am trying to get the results of top (more specifically htop) but every time it prints nothing, whereas any other command (ls, pwd, etc...) returns the output fine. My objective is to get access to the process stats that are returned to the screen. Here is the latest example which displays noth

Re: [go-nuts] calling cmd

2021-01-28 Thread Ian Lance Taylor
On Thu, Jan 28, 2021 at 9:29 AM Jeff Mangan wrote: > > I am trying to get the results of top (more specifically htop) but every > time it prints nothing, whereas any other command (ls, pwd, etc...) returns > the output fine. My objective is to get access to the process stats that are > return

[go-nuts] Re: calling cmd

2021-01-28 Thread 'Carla Pfaff' via golang-nuts
"htop" doesn't exit (the channel read blocks until exit), and it uses ANSI escape codes for colorful output. You'd be better served by "top -b -n 1" (Linux) or "top -l1" (macOS). -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe f

Re: [go-nuts] What compatibility of go/ast, go/types, go/packages packages is planned, if any, when transitioning toward go2 ?

2021-01-28 Thread Ian Lance Taylor
On Thu, Jan 28, 2021 at 3:43 AM 'Carla Pfaff' via golang-nuts wrote: > > On Wednesday, 27 January 2021 at 23:28:17 UTC+1 Ian Lance Taylor wrote: >> >> To be clear, there is no Go 2, and there are no plans for Go 2. > > > For someone who follows the mailing lists and issue comments this has been >

Re: [go-nuts] Code coverage in error cases when compared to other languages

2021-01-28 Thread 'Thomas Bushnell BSG' via golang-nuts
IMO: To give these things names, you have: func Foo(...) ..., error { do things here... err := makeASubroutineCall(...) if err != nil { return ..., err } do more things } And we suppose that makeASubroutineCall is already will tested and you know it returns errors correctly. What i

Re: [go-nuts] calling cmd

2021-01-28 Thread Kurtis Rader
On Thu, Jan 28, 2021 at 9:29 AM Jeff Mangan wrote: > I am trying to get the results of top (more specifically htop) but every > time it prints nothing, whereas any other command (ls, pwd, etc...) returns > the output fine. My objective is to get access to the process stats that > are returned t

[go-nuts] Virtual time for testing

2021-01-28 Thread Christian Worm Mortensen
Hi! Suppose I want to unit test this function: func generator() <-chan int { ret := make(chan int) go func() { for i := 0; i < 10; i++ { ret <- i time.Sleep(time.Second) } }() return ret } What is a good way to do that? One way is to do it is like this: func testGenerator() { start := time.Now(

[go-nuts] Re: Virtual time for testing

2021-01-28 Thread Amnon
Try something like github.com/facebookgo/clock On Thursday, 28 January 2021 at 21:15:50 UTC Christian Worm Mortensen wrote: > Hi! > > Suppose I want to unit test this function: > > func generator() <-chan int { > ret := make(chan int) > go func() { > for i := 0; i < 10; i++ { > ret <- i > time.

Re: [go-nuts] calling cmd

2021-01-28 Thread Jeff Mangan
XY Problem I'll be using that in the future :-) Yeah, I just wanted to see those stats and thought I would write a go app to do it just for the sake of writing some go code. It's not important. Thanks for the info. On Thu, Jan 28, 2021 at 2:08 PM Kurtis Rader wrote: > On Thu, Jan 28, 2021

Re: [go-nuts] Re: Virtual time for testing

2021-01-28 Thread Christian Worm Mortensen
Hi Amnon, Thank you for your suggestion. I have taken a look at the package but it does not seem to really work. It seems to rely on runtime.Gosched() to suspend the current go routine until all other go routines are blocked. That is, it relies on runtime.Gosched() to provide functionality simila

[go-nuts] Delve v1.6.0 is released

2021-01-28 Thread Derek Parker
Hello Gophers, Announcing the Delve v1.6.0 release! Thanks to everyone who contributed to this release! Notable changes: * Go 1.16 support * Apple M1 support * Syntax highlighting for code blocks (in terminal) * Bug fixes, performance improvements and more! Check out the full CHANGELOG here

[go-nuts] Re: Go 1.16 Release Candidate 1 is released

2021-01-28 Thread Nikolay Dubina
This is great! Thank you! On Thursday, January 28, 2021 at 11:27:49 PM UTC+8 Alex Rakoczy wrote: > Hello gophers, > > We have just released go1.16rc1, a release candidate version of Go 1.16. > It is cut from release-branch.go1.16 at the revision tagged go1.16rc1. > > Please try your production lo

[go-nuts] Passing string to a c-struct member of type void*

2021-01-28 Thread Nicholas Yue
Hi, I have the following struct in C == struct DataStruct { const char *name; const void *data; int type; int arraylength; size_t count; int flags; }; == I am trying to pass a string/(char *) to data. What is the correct approac