Re: [go-nuts] Re: go on Windows 10 from the bash shell (and the cmd shell)

2017-10-11 Thread Pat Farrell
On Wed, Oct 11, 2017 at 11:32 PM, wrote: > Did you install the Windows or Linux go binary distribution? > I went to the distribution site and installed the .msi file like any windows installation I've been running bash since about 1987, so I'm partial to it. Other than the

Re: [go-nuts] [ANN] Frame - Plan9 libframe in Go

2017-10-11 Thread Nigel Tao
On Wed, Oct 11, 2017 at 2:30 PM, as wrote: > https://github.com/as/frame Nice! -- 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

[go-nuts] Re: go on Windows 10 from the bash shell (and the cmd shell)

2017-10-11 Thread brainman
On Thursday, 12 October 2017 11:23:08 UTC+11, Pat Farrell wrote: > ... But there was nothing that told me why. Are you asking me why all your Go code should live inside of single directory? Hopefully others will reply. But I think it is because Go does not use any config files to build

[go-nuts] Why go does't have NullInt type on database/sql?

2017-10-11 Thread 高橋誠二
There are NullInt64 and NullFloat64, but not about NullInt, NullFloat. (or NullInt32 etc...) After scanning from rds, my team always convert them to int, but it seems so silly. What is the reason? -- You received this message because you are subscribed to the Google Groups "golang-nuts"

[go-nuts] Re: go on Windows 10 from the bash shell (and the cmd shell)

2017-10-11 Thread Pat Farrell
I found how to force 'go build' to work under the bash shell on Winderz you have to add a symlink in the program directory containing go.exe such as ln -s go.exe go On Wednesday, October 11, 2017 at 7:59:04 PM UTC-4, brainman wrote: > > On Thursday, 12 October 2017 09:28:42 UTC+11, Pat

[go-nuts] Re: go on Windows 10 from the bash shell (and the cmd shell)

2017-10-11 Thread brainman
On Thursday, 12 October 2017 09:28:42 UTC+11, Pat Farrell wrote: > Yes, I didn't understand what a "workspace" is. Still don't know what that buzzword means. I suggested you read https://golang.org/doc/code.html - it should answer your question. But if you prefer me explaining it (and I am not

[go-nuts] Re: What is the best way to represent functional options within factory methods?

2017-10-11 Thread Kevin Malachowski
Why do you need all of your factories to have a common parameter? Also, what problem are you trying to solve? If you're just trying to organize your code, to what end are you pursuing this generalization? That is, what would you like your final code to look like? (Feel free to use psuedocode to

[go-nuts] Re: go on Windows 10 from the bash shell (and the cmd shell)

2017-10-11 Thread brainman
> On Thursday, 12 October 2017 02:34:49 UTC+11, Pat Farrell wrote: > > https://golang.org/doc/install This one says "... Next, make the directory src/hello inside your workspace ...". And, I take it, you skipped that step. > ... Microsoft has decided to provide a real bash shell with real

[go-nuts] Re: DNS Resolver options

2017-10-11 Thread 'Pushkar' via golang-nuts
Thanks Dave. I am aware of that repo but it doesn't provide an abstraction of the resolver functionality. I found https://github.com/bogdanovich/dns_resolver which is written using miekg/dns. It is lacking some of the options that libraries like c-ares have (using TCP and controlling timeout).

[go-nuts] DNS Resolver options

2017-10-11 Thread Dave Cheney
Try https://github.com/miekg/dns -- 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

[go-nuts] DNS Resolver options

2017-10-11 Thread 'Pushkar' via golang-nuts
Hello, I would like to control the dns lookup timeout, the number of retries and also the ability to use TCP for the DNS resolution. I am from the C/C++ world and c-ares has options to control these. I am not findiing either of these as options in the go net package. Am I not looking in the right

[go-nuts] Re: What is the best way to represent functional options within factory methods?

2017-10-11 Thread Frank Ruiz
Thank you Alex for the link. Will check it out. To further clarify, the issue I am having is with: opts …func(*procStruct) opts …func(*sysStruct) I have multiple structs other than *procStruct (as listed in the example), so I am trying to find the best way to generalize this parameter so I can

[go-nuts] Gomobile and SAF

2017-10-11 Thread audrius . butkevicius
So I've been going back and forth with this in https://github.com/golang/go/issues/105808. Syncthing on Android consists of two parts, one is the actual android UI/wrapper, and second is GOOS=linux GOARCH=arm Go binary that the android UI starts and manipulates using a rest API. >From the Go

[go-nuts] Building a neural net from scratch

2017-10-11 Thread Daniel Whitenack
Hi all. I just released a blog post about building a neural net in Go from scratch: http://www.datadan.io/building-a-neural-net-from-scratch-in-go/. Hope this is interesting for some and inspires more of this sort of thing. Would love to talk about it here or in the #data-science channel on

Re: [go-nuts] Sync pool old data

2017-10-11 Thread Ian Lance Taylor
On Wed, Oct 11, 2017 at 12:50 PM, XXX ZZZ wrote: > > So I'm starting to play with sync pool on a program that needs to allocate a > ton of short lived objects per server request. Performance seems to be > better when using sync pool however I've noticed that upon

[go-nuts] Re: What is the best way to represent functional options within factory methods?

2017-10-11 Thread Frank Ruiz
Thank you Alex. To further clarify, what I am trying to do is create factory methods that return a common interface. In a nutshell, I am trying to create constructors that take a common argument. As it stands, the parameter I specify is very specific (function with a pointer to a struct):

[go-nuts] Sync pool old data

2017-10-11 Thread XXX ZZZ
Hello, So I'm starting to play with sync pool on a program that needs to allocate a ton of short lived objects per server request. Performance seems to be better when using sync pool however I've noticed that upon releasing the object and then retrieving it again, will produce a "new object"

[go-nuts] Re: What is the best way to represent functional options within factory methods?

2017-10-11 Thread Alex Buchanan
I'm not sure I understand the example, but have you seen the grpc library's use of options? For more type safety, you could define an interface such as type PluginOpt interface { pluginOpt() }. https://godoc.org/google.golang.org/grpc#CallOption On Wednesday, October 11, 2017 at 11:23:16 AM

Re: [go-nuts] Strange behavior when dealing with certain emojis

2017-10-11 Thread Michael Jones
...obviously! it suggests a part of technical life lacking the prefix-decoding property. If things are to EVER be that way generally (the clumpy aggregate way) it would be remarkably better to always have prefix codes or have aggregate "boxing symbols" as wrappers. this notion of a trailing

[go-nuts] Task scheduler as a library?

2017-10-11 Thread Alex Buchanan
Hey all, In Funnel (a distributed task toolkit) we're sort of dancing around having a full-on scheduler. We have a scheduler that has grown from development util, to prototype, to something we actually use, but it's missing many of the features you'd want in production. Mostly we aim to

Re: [go-nuts] How to covert simple RPC Call in Python to Go?

2017-10-11 Thread Justin Israel
On Wed, Oct 11, 2017, 9:51 AM Christian LeMoussel wrote: > > connections.send(s, "getwork", 10) > > I searched a little bit more and here is in Python send() function > > def send(sdef, data, slen): > sdef.setblocking(0) > >

[go-nuts] What is the best way to represent functional options within factory methods?

2017-10-11 Thread Frank Ruiz
Greetings, Was hoping to solicit some feedback on utilizing functional options in conjunction with factory methods. I currently have the following function: func ProcPlugin(opts …func(*procStruct){ p := defaulProc for _, opt := range opts { opt() } return , nil } I am now trying to generalize

[go-nuts] Re: go on Windows 10 from the bash shell (and the cmd shell)

2017-10-11 Thread Tamás Gulácsi
WSL is a (nice) hack with rough edges: you can invoke Windows applications (go.exe) from that bash, or install the Linux go under WSL, and have "go" as under Linux. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

Re: [go-nuts] Strange behavior when dealing with certain emojis

2017-10-11 Thread as
>which puts a keycap symbol around the previous character Something about this sentence disturbs me. On Wednesday, October 11, 2017 at 3:36:16 AM UTC-7, Ian Davis wrote: > > > On Wed, 11 Oct 2017, at 11:16 AM, Gianguido Sorà wrote: > > Uhm, so the Replacer sees it as two separate entities, and

[go-nuts] Re: go on Windows 10 from the bash shell (and the cmd shell)

2017-10-11 Thread Pat Farrell
On Wednesday, October 11, 2017 at 4:12:45 AM UTC-4, brainman wrote: > > > On Wednesday, 11 October 2017 16:04:28 UTC+11, Pat Farrell wrote: > > 1) is the standard documentation wrong/out of date? > > What documentation are you referring to? Did you read > https://golang.org/doc/code.html ? >

Re: [go-nuts] Scope of variables with closures

2017-10-11 Thread etienne . daspe
Thank you for the explanations, I understand it better now. Etienne On Wednesday, 11 October 2017 14:26:56 UTC+2, Marvin Renich wrote: > > * Marvin Renich [171011 08:19]: > > > >> > //func fibo2() func() (x int) { > > ^ > > > > Here, x is a

Re: [go-nuts] Scope of variables with closures

2017-10-11 Thread Marvin Renich
* Marvin Renich [171011 08:19]: > > >> > //func fibo2() func() (x int) { > ^ > > Here, x is a placeholder name within a type literal; it is not within > the scope of fibo. ^ Typo; should be fibo2. ...Marvin -- You received this

Re: [go-nuts] Scope of variables with closures

2017-10-11 Thread Marvin Renich
* etienne.da...@gmail.com [171011 03:14]: > I was thinking of your answer, and I don't understand when you say: > > > within a func type literal such as `func() (x int)`, the scope of the > > parameters and results is restricted to the type literal itself. > > > Because

Re: [go-nuts] Re: go on Windows 10 from the bash shell (and the cmd shell)

2017-10-11 Thread Wojciech S. Czarnecki
On Wed, 11 Oct 2017 01:12:45 -0700 (PDT) brainman wrote: > What bash shell are you talking about? Windows does not come > with bash shell. Ooops, now it comes: https://msdn.microsoft.com/en-us/commandline/wsl/about. > If you have Linux install, then you should install

Re: [go-nuts] A few go 2 suggestions

2017-10-11 Thread Scott Cotton
The difference is that go-routine level defers could be added further down the call stack and so could reference objects not visible in the calling "go ...()" scope. So it could simplify the messy task of cleaning up goroutines (implemented now by eg Context, tomb, etc) No need to identiy

Re: [go-nuts] Strange behavior when dealing with certain emojis

2017-10-11 Thread Ian Davis
On Wed, 11 Oct 2017, at 11:16 AM, Gianguido Sorà wrote: > Uhm, so the Replacer sees it as two separate entities, and replaces > the part of the composite that matches one of the cases. Sort of. The emoji is really just the "\xE2\x83\xA3" part (or "\U20e3") which puts a keycap symbol around

Re: [go-nuts] Strange behavior when dealing with certain emojis

2017-10-11 Thread Ian Davis
On Wed, 11 Oct 2017, at 10:33 AM, Ian Davis wrote: > > On Wed, 11 Oct 2017, at 09:57 AM, Gianguido Sorà wrote: >> >> I'm writing a small utility which uses a strings.Replacer to process >> some substitutions in some strings; these strings contains UTF-8 >> characters as well as emojis.>> >>

[go-nuts] Re: Speeding up a concurrent "simple" web server

2017-10-11 Thread lee
Thanks Dave, I just used "hey" (I didn't realise that ab was quite so bad!), it looks much better! Summary: Total: 36.1492 secs Slowest: 0.3418 secs Fastest: 0.0002 secs Average: 0.0349 secs Requests/sec: 2766.3147 Total data: 459420 bytes Size/request: 45942 bytes

Re: [go-nuts] Strange behavior when dealing with certain emojis

2017-10-11 Thread Jan Mercl
On Wed, Oct 11, 2017 at 11:34 AM Ian Davis wrote: > At first glance this looks like a bug in strings.Replacer. What bug do you mean? https://play.golang.org/p/0DBwWt2TU9 -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts"

Re: [go-nuts] Strange behavior when dealing with certain emojis

2017-10-11 Thread Ian Davis
On Wed, 11 Oct 2017, at 09:57 AM, Gianguido Sorà wrote: > > I'm writing a small utility which uses a strings.Replacer to process > some substitutions in some strings; these strings contains UTF-8 > characters as well as emojis.> > Here you can find a playground with an example: >

Re: [go-nuts] Strange behavior when dealing with certain emojis

2017-10-11 Thread Jan Mercl
On Wed, Oct 11, 2017 at 10:58 AM Gianguido Sorà wrote: WAI: "\x32" == "2" -- -j -- 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

[go-nuts] Re: go on Windows 10 from the bash shell (and the cmd shell)

2017-10-11 Thread brainman
> On Wednesday, 11 October 2017 16:04:28 UTC+11, Pat Farrell wrote: > 1) is the standard documentation wrong/out of date? What documentation are you referring to? Did you read https://golang.org/doc/code.html ? > 2) how do I get the go build process to create a hello.exe rather than go.exe?

[go-nuts] Re: How to convert JSON message to Go struct

2017-10-11 Thread Christian LeMoussel
It's OK.Thank you very much. -- 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

Re: [go-nuts] Scope of variables with closures

2017-10-11 Thread etienne . daspe
I was thinking of your answer, and I don't understand when you say: > within a func type literal such as `func() (x int)`, the scope of the > parameters and results is restricted to the type literal itself. > Because the following code works, so the scope of a parameter is different than the

[go-nuts] Re: How to convert JSON message to Go struct

2017-10-11 Thread Tamás Gulácsi
s1, i1, s2, i2 := workpack[0][0].(string), int(workpack[0][1].(float64)), workpack[0][2].(string), int(workpack[0][3].(float64)) 2017. október 11., szerda 9:02:17 UTC+2 időpontban Christian LeMoussel a következőt írta: > > Ok but how can I acces four values? > > I do this > segments = >

[go-nuts] Re: go on Windows 10 from the bash shell (and the cmd shell)

2017-10-11 Thread as
A Go project is organized as a file system. The directory your go source files reside in indicate the name of the executable created with go build. On Tuesday, October 10, 2017 at 10:04:28 PM UTC-7, Pat Farrell wrote: > > I've installed the go 1.9 binary distribution on my windows 10 laptop. >

Re: [go-nuts] Re: How to convert JSON message to Go struct

2017-10-11 Thread Gianguido Sorà
You should operate type assertion by iterating on the array. My advice is to write a "Work" struct with all the field you need, and create an instance for each iteration of the outer array. This way you'll have a nice representation of a "Work" package for each inner array. I cannot

[go-nuts] Re: How to convert JSON message to Go struct

2017-10-11 Thread Christian LeMoussel
Ok but how can I acces four values? I do this segments = []byte("[[\"19c87d4ddf59160406821ca102aa4f49846ecf5ac3d41d2007883834\", 75, \"b54317cb538c6b3a5ae8b84f8b53c83652037038ad8ad6bef4c8b43a\", 101]]") var workPack [][]interface{} err = json.Unmarshal(segments, )

[go-nuts] Re: How to convert JSON message to Go struct

2017-10-11 Thread Dave Cheney
Sadly this is not a JSON object, it's an array containing an array containing four values. The Go defintion created for you by that tool is the best way to express this data in Go. On Wednesday, 11 October 2017 17:40:41 UTC+11, Christian LeMoussel wrote: > > > Hi, I'm new to Go, > > I have

[go-nuts] How to convert JSON message to Go struct

2017-10-11 Thread Christian LeMoussel
Hi, I'm new to Go, I have difficulty to converts JSON into a Go type definition. *JSON* [["19c87d4ddf59160406821ca102aa4f49846ecf5ac3d41d2007883834", 75, "b54317cb538c6b3a5ae8b84f8b53c83652037038ad8ad6bef4c8b43a", 101]] *Go type definition with JSON-to-Go Convert