[go-nuts] Re: Help get me started on a project

2019-12-18 Thread silviucapota
Have a look at: https://github.com/chzyer/readline https://github.com/chzyer/readline/blob/master/example/readline-demo/readline-demo.go On Tuesday, 17 December 2019 09:10:28 UTC-5, Rich wrote: > > I need to write a program that runs an external program and the user needs > to interact with

[go-nuts] Re: GO lang not able to decrypt the xor-base64 text

2019-01-21 Thread silviucapota
Like Christian said, your main problem is how Javascript and how Go iterate. In your Javascript example, you use: for(var i=0;ihttps://play.golang.org/p/23nMX2dFhJF On Sunday, 20 January 2019 10:14:05 UTC-5, Soorya Prakash wrote: > > > I am using the below code to encrypt and decrypt the

Re: [go-nuts] Is conversion between int and uint a no-op i.e. is it free

2018-11-24 Thread silviucapota
A very nice tool from Matt Godbolt (and team of volunteers): https://godbolt.org/z/4nt5cJ You can switch compiler version (e.g. Go 1.4, 1.7, 1.9, 1.11, tip, etc) and/or gccgo, take a look at variations, etc On Saturday, 24 November 2018 11:07:51 UTC-5, Jan Mercl wrote: > > On Sat, Nov 24, 2018

Re: [go-nuts] defining custom struct, confused

2018-09-26 Thread silviucapota
Two things: 1) Capitalize users inside allUsers so it can be populated via reflection 2) Use an intermediary type to allow for that slice inside slice https://play.golang.org/p/RvW7PMSOZlq On Wednesday, 26 September 2018 10:10:41 UTC-4, Mudasir Mirza wrote: > > Also as per the API documentation

[go-nuts] Re: Why does this struct escape to the heap?

2018-09-04 Thread silviucapota
Hi Paul, Check out: https://golang.org/doc/effective_go.html#pointers_vs_values Basically, in your index1, the opts.isDigit passed to IndexFunc is syntactic sugar for ().isDigit -> then the compiler needs to move opts on the heap. You can either a) define an alternate isDigitVal method,

[go-nuts] Re: Working with import "google.golang.org/api/admin/directory/v1"

2018-08-26 Thread silviucapota
Hi John If you look at the source code, you will notice that the User struct they have makes use of a custom MarshallJSON method, which accepts ForceSendFields (as defined inside the User type) So what you might need to do, is add that "Suspended" into that slice and it will marshall it to

[go-nuts] Re: Accessing Slices Made From Same Array Concurrently

2018-04-22 Thread silviucapota
Kaveh, for this particular circumstance, based on your playground snippet, that's why you got no race. As per the original 2013 race detector blog post, "Because of its design, the race detector can detect race conditions only when they are actually triggered by running code, which means it's

[go-nuts] Re: Accessing Slices Made From Same Array Concurrently

2018-04-21 Thread silviucapota
Hi Kaveh, Change the line: *ptr = append(*ptr, []byte(fmt.Sprint*f("%02d"*, k1))...) to *ptr = append(*ptr, []byte(fmt.Sprintf(*"%15d"*, k1))...) The buckets will overlap (more than 10 bytes) and you will get the race triggered in the detector Silviu On Saturday, 21 April 2018 12:40:04

[go-nuts] Re: Gobot Beaglebone Black GPIO question...

2018-02-11 Thread silviucapota
Hmm... I actually looked at that .On method. It does in fact call Subscribe(), then spawns a go routine. Strange, so maybe it is a device specific issue. Maybe try to move those .On handlers before the work := func() block, just in case... On Monday, 12 February 2018 00:41:58 UTC-5, Silviu

[go-nuts] Re: Gobot Beaglebone Black GPIO question...

2018-02-11 Thread silviucapota
Hi Curtis, I used to play a bit with a Beaglebone Black a few years ago, but it's now gathering dust at my father's place. I really liked it at the time. Can you double check that you are correctly using your *work := func() ...* construct ? Here's what that documentation of the

[go-nuts] Re: Nil Channels and Case Evaluation

2017-12-30 Thread silviucapota
Hi, I think your answer can be found in this section: https://golang.org/ref/spec#SendStmt "Both the channel and the *value expression are evaluated* before communication begins" cheers, silviu On Sunday, 31 December 2017 01:44:31 UTC-5, dc0d wrote: > > Assume there is this select statement:

[go-nuts] Re: Variable scope for text/template

2017-10-07 Thread silviucapota
Hein, you can try passing a function to the template. That is, a function which de-normalizes your person struct into an ad-hoc Num + Name record See here: https://play.golang.org/p/1XIIO-0lcu Cheers Silviu On Friday, 6 October 2017 01:22:49 UTC-4, Hein Meling wrote: > > Hi all, > > Please see

[go-nuts] Re: context cancellation flake

2017-09-17 Thread silviucapota
Steven, no problem. For more details have a look at a) This talk by Sameer Ajmani: https://vimeo.com/115309491 b) Francesc Campoy's series of videos: https://github.com/campoy/justforfunc In the Readme, you'll find likes to episodes 9 and 10, which deal with explaning and implementing the

[go-nuts] Re: context cancellation flake

2017-09-16 Thread silviucapota
Hi Steven, In case it's still unclear, you need to wrap both the "do request" + "read body" inside the same cancellation context. The "defer cancel" should encompass both of them, sort of atomically, so the idea is to take it out of your fetch, one level up.

[go-nuts] Re: Golang 1.9 failing with excelize (simple case works under 1.8.3)

2017-08-30 Thread silviucapota
This library https://github.com/plandem/xlsx that was advertised here a few days ago worked for me with your initial test.xlsx On Wednesday, 30 August 2017 18:42:19 UTC-4, G Shields wrote: > > Tried the trick with saving under LibreOffice and MS excel, and in both > cases the files created are

[go-nuts] Re: Golang 1.9 failing with excelize (simple case works under 1.8.3)

2017-08-28 Thread silviucapota
Interesting... For this portion of code: https://github.com/360EntSecGroup-Skylar/excelize/blob/master/rows.go#L76-L85 The xml decoder returns row and col token types for 1.8.3 but rushes into an EOF for 1.9 If the document gets re-saved with LibreOffice for example, it works, so it may be

Re: [go-nuts] Re: Code Review - Applying functions on custom types

2017-07-20 Thread silviucapota
Hi Sofiane, Answering the "what type" question is pretty much unavoidable. You can embed that forking logic inside the "on the fly" function, like in Roger's example (using a switch v := v.(type) construct) or you can use reflect. Alternatively, you can group your transformation functions

[go-nuts] Re: Golang, SQL and ORM avoidance techniques

2017-06-03 Thread silviucapota
Hi Adam, Back in 2014 I had the same driving motives like you and I ended up writing my own generator for Postgres (to deal with tables, views, and functions, for the basic types): https://github.com/silviucm/pgtogogen