Re: [go-nuts] Re: Deploying go https servers

2017-03-10 Thread Kevin Powick
I haven't done that, but with what little I do know about that type of deployment, I cannot see how choosing Caddy would make any difference. If you do go that route, I would appreciate hearing about any success or problems that you have. -- Kevin Powick On Friday, 10 March 2017 22:33:29

Re: [go-nuts] Re: Deploying go https servers

2017-03-10 Thread Sankar P
Just curios to know if I am going to use kubernetes for deployment, would choosing Caddie make any difference (either good or bad) ? I will investigate myself later, but wanted to know your opinion, incase you have already done that. Thanks. 2017-03-10 20:46 GMT+05:30 Kevin Powick

[go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread prades . marq
You might want to reconsider your use of Go if the lack of generics hinders your productivity. Code generation, IDE macros and other tricks do not solve this problem. Sometimes go is just not the right tool for the job. D has generics and solid concurrency primitives. Le vendredi 10 mars

Re: [go-nuts] Bug in regexp package?

2017-03-10 Thread Ian Davis
On Sat, 11 Mar 2017, at 12:52 AM, fishyw...@gmail.com wrote: > Playground link is at https://play.golang.org/p/6uXcuL3iyF > > I tried to match "asdf \t\n" against `\s*` and it doesn't match, > but `\s+` works. Am I holding it wrong? FindStringIndex returns nil for no match but your

Re: [go-nuts] Bug in regexp package?

2017-03-10 Thread Ian Lance Taylor
On Fri, Mar 10, 2017 at 4:52 PM, wrote: > Playground link is at https://play.golang.org/p/6uXcuL3iyF > > I tried to match "asdf \t\n" against `\s*` and it doesn't match, but > `\s+` works. Am I holding it wrong? \s* matches any number of whitespace characters,

[go-nuts] Bug in regexp package?

2017-03-10 Thread fishywang
Playground link is at https://play.golang.org/p/6uXcuL3iyF I tried to match "asdf \t\n" against `\s*` and it doesn't match, but `\s+` works. Am I holding it wrong? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

Re: [go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread Michael Jones
Nothing wrong with it, and nothing wrong with doing it for min and max either. (Though it was a delight to see that animated editing sequence, so for entertainment value that's the way!) I did code generation for my version of Sort and it is 3x-5x faster. It takes intel more than 10 years to make

Re: [go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread Tyler Compton
If we assume a more useful generic task than writing a min function, what's wrong with using code generation? On Fri, Mar 10, 2017 at 6:14 AM Henry wrote: > If you insist on generics-like code generation: > https://github.com/cheekybits/genny/blob/master/README.md >

Re: [go-nuts] Re: Gracefully Shutdown File Server

2017-03-10 Thread Bruno Albuquerque
Forget it. It is in a defer call. I guess I have no idea why it is behaving how it is. On Fri, Mar 10, 2017 at 12:49 PM Bruno Albuquerque wrote: > Wait, you are explicitly calling the context cancel function. As I > understand it that will shutdown the server immediately).

Re: [go-nuts] Re: Gracefully Shutdown File Server

2017-03-10 Thread Bruno Albuquerque
Wait, you are explicitly calling the context cancel function. As I understand it that will shutdown the server immediately). On Fri, Mar 10, 2017 at 12:35 PM Andrew wrote: > go install and run the program, get the same result. > > -- > You received this message because you

Re: [go-nuts] Re: Gracefully Shutdown File Server

2017-03-10 Thread Andrew
go install and run the program, get the same result. -- 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,

Re: [go-nuts] Re: Gracefully Shutdown File Server

2017-03-10 Thread jimmy frasche
Maybe go run is eating the signal? Does it still misbehave with go build? On Fri, Mar 10, 2017 at 12:18 PM, Bruno Albuquerque wrote: > I am not very familiar with the shutdown process yet (I did not try to use > it anywhere), but the documentation seems to imply that what you

Re: [go-nuts] Re: Gracefully Shutdown File Server

2017-03-10 Thread Bruno Albuquerque
I am not very familiar with the shutdown process yet (I did not try to use it anywhere), but the documentation seems to imply that what you expected to happen is what should happen. So if the download is being interrupted, I guess that is a bug. On Fri, Mar 10, 2017 at 11:33 AM Andrew

Re: [go-nuts] Re: Gracefully Shutdown File Server

2017-03-10 Thread Andrew
Suppose I have a new folder with two files, main.go(code from the link) and myfile.iso(large file). After "go run main.go" from the console, open browser and type "localhost:8080/myfile.iso" to download the file. Back to the console and Ctrl+c to shut down the server when the file is

Re: [go-nuts] Re: Gracefully Shutdown File Server

2017-03-10 Thread Bruno Albuquerque
I am not sure what you were expecting as a result of your example, but it appears to work for me in Ubuntu: $ go run test.go 2017/03/11 03:03:13 Server started at localhost:8080 ^C2017/03/11 03:03:19 Shutting down server... 2017/03/11 03:03:19 Server gracefully stopped On Fri, Mar 10, 2017 at

Re: [go-nuts] Re: Gracefully Shutdown File Server

2017-03-10 Thread Andrew
I have this simple program to serve files in the root folder. It always terminates immediately whenever I press Ctrl+C key and the file download process will be failed right away. I tried it in Windows 7 and Ubuntu 16.04. https://play.golang.org/p/Akv3se9kkZ -- You received this message

Re: [go-nuts] Re: Gracefully Shutdown File Server

2017-03-10 Thread Bruno Albuquerque
https://golang.org/pkg/net/http/#Server.Shutdown func (*Server) Shutdown func (srv *Server ) Shutdown (ctx context

[go-nuts] Re: Gracefully Shutdown File Server

2017-03-10 Thread Andrew
Thanks Dave. According to your example, the server is shutdown immediately even in the middle of downloading a large file. I can use a timeout to close the connection. but is there some way to know we've finished serving all files before we close it? Andrew -- You received this message

Re: [go-nuts] Re: Compiler's Interface Check Problem

2017-03-10 Thread Ian Lance Taylor
On Fri, Mar 10, 2017 at 7:19 AM, Henry wrote: > > Thanks for the reply. I will rephrase the question. See the code > illustration in the first post if you did not follow the discussion from the > beginning. > > a.Arg and b.Arg are identical interfaces living in

Re: [go-nuts] Re: Compiler's Interface Check Problem

2017-03-10 Thread Paul Jolly
> > Thanks for the reply. I will rephrase the question. See the code > illustration in the first post if you did not follow the discussion from > the beginning. > Indeed, I've been following since you first posted so I saw that illustration. > a.Arg and b.Arg are identical interfaces living in

[go-nuts] Re: scriptable rules?

2017-03-10 Thread Tieson Molly
I think I answered my own question https://github.com/AdamJonR/dialects On Friday, March 10, 2017 at 10:41:04 AM UTC-5, Tieson Molly wrote: > > > > Thanks Ben, is it this one? > > https://github.com/robertkrimen/otto > > Are there any projects for creating DSLs in Go? > > On Friday, March 10,

[go-nuts] Re: scriptable rules?

2017-03-10 Thread Tieson Molly
Thanks Ben, is it this one? https://github.com/robertkrimen/otto Are there any projects for creating DSLs in Go? On Friday, March 10, 2017 at 9:28:22 AM UTC-5, Ben B wrote: > > Otto seems popular for running javascript inside a native Go VM. > > On Thursday, 9 March 2017 16:28:42 UTC,

Re: [go-nuts] Re: Compiler's Interface Check Problem

2017-03-10 Thread Henry
Hi, Thanks for the reply. I will rephrase the question. See the code illustration in the first post if you did not follow the discussion from the beginning. a.Arg and b.Arg are identical interfaces living in different packages: package a and package b respectively. Type X that implements

[go-nuts] Re: Deploying go https servers

2017-03-10 Thread Kevin Powick
I know you're just looking for a checklist, but we found it better to use Caddy (built in Go) as our web, and then have our Go API service proxied via that. It's pretty awesome because it's so easy to use Caddy in that way. For example : http://mydomain/mypage will serve up your page, but

Re: [go-nuts] How to test for unicode property "Variation Selector"

2017-03-10 Thread Konstantin Khomoutov
On Fri, 10 Mar 2017 05:03:25 -0800 (PST) JohnGB wrote: > I have some text that I'm processing which includes emoji. I'm > trying to strip out all the emoji by using checking whether a rune > fulfils unicode.IsSymbol(). This strips out the emoji, but it seems > that some

[go-nuts] Re: `go test` does not honor -ldflags

2017-03-10 Thread marcus.low via golang-nuts
Actually, you can do $ go test -v -ldflags="-X import/path/to/main.test.MyVar=hello" -- -- *Grab is hiring. Learn more at **https://grab.careers * By

[go-nuts] Re: scriptable rules?

2017-03-10 Thread Ben B
Otto seems popular for running javascript inside a native Go VM. On Thursday, 9 March 2017 16:28:42 UTC, Tieson Molly wrote: > > Are there any good libraries or packages to > handle complex rule sets dynamically? > > I was thinking either some sort of embedded Prolog in Go > or maybe Lua, but

Re: [go-nuts] Re: Compiler's Interface Check Problem

2017-03-10 Thread Paul Jolly
As far as a.Worker and b.Worker not being identical, the relevant section of the spec is: https://golang.org/ref/spec#Type_identity *Two interface types are identical if they have the same set of methods > with the same names and identical function types. Lower-case method names > from different

[go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread Henry
If you insist on generics-like code generation: https://github.com/cheekybits/genny/blob/master/README.md -- 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] How to test for unicode property "Variation Selector"

2017-03-10 Thread JohnGB
I have some text that I'm processing which includes emoji. I'm trying to strip out all the emoji by using checking whether a rune fulfils unicode.IsSymbol(). This strips out the emoji, but it seems that some emoji include a unicode variation selector that is not stripped out. So I also need

[go-nuts] Re: Compiler's Interface Check Problem

2017-03-10 Thread Henry
Let's suppose a.Worker and b.Worker both have method Work(c.Arg) where c.Arg is a struct instead of an interface. The compiler now recognizes both a.Worker and b.Worker as identical although both live in different packages. The code will compile just fine. I don't think it matters where the

[go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread Ignazio Di Napoli
Wow. :) -- 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 https://groups.google.com/d/optout.

[go-nuts] Re: Compiler's Interface Check Problem

2017-03-10 Thread Volker Dobler
The two type a.Arg and b.Arg are different type because the live in different packages. Same for a.Worker and b.Worker. Different packages --> different types. Laxing this rule would open a can of worms: Suddenly your axis.Point and rating.Point become assignable, just because the "are the same".

[go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread Egon
On Friday, 10 March 2017 10:29:20 UTC+2, hui zhang wrote: > > I want to generate a min func > Why? That doesn't sound like a good use of time. :P You would probably much faster using keyboard macros or multiple cursors e.g. (real-time)

[go-nuts] Re: how to use go generate to generate generic code .

2017-03-10 Thread hui zhang
And pls don't tell me interface{} is good , can solve your problem bla bla bla when interface{} meet slice []int --> []interface{} , all generic can not be done 在 2017年3月10日星期五 UTC+8下午4:29:20,hui zhang写道: > > > > I want to generate a min func > > func Min(a,b T) T { >if a < b { >

[go-nuts] how to use go generate to generate generic code .

2017-03-10 Thread hui zhang
I want to generate a min func func Min(a,b T) T { if a < b { return a } else { return b } } pls generate below, pls use go generate to generate int int64 int32 int16 uint64 uint32 float32 float64 Pls do not just paste documents. There is a lot on google.

[go-nuts] Compiler's Interface Check Problem

2017-03-10 Thread Henry
Hi, I notice Go's compiler examines the interface signature somewhat superficially. It is best to explain the situation using code: Given in Package a, package a type Arg interface{ DoSomething() } type Worker interface{ Work(arg Arg) } func NewWorker() Worker{ //... } Then