[go-nuts] Re: How to capture stderr/stdout of cgo calls?

2016-08-05 Thread Markus Zimmermann
The documentaton says that freopen closes the original stream. Wouldn't that mean, that it is not possible to restore the origianl stderr/stdout? On Friday, August 5, 2016 at 4:52:57 AM UTC+2, mattn wrote: > > I guess calling freopen is better because cgo possibly having reference of > stdin/std

Re: [go-nuts] SetSafe default value in mgo session

2016-08-05 Thread Serhat Şevki Dinçer
There is the difference of (not) calling https://docs.mongodb.com/v3.0/reference/method/db.getLastError/ This is possibly a better place to ask this: https://groups.google.com/forum/m/#!forum/mgo-users -- You received this message because you are subscribed to the Google Groups "golang-nuts" g

Re: [go-nuts] SetSafe default value in mgo session

2016-08-05 Thread Kiki Sugiaman
Then the answer to your question is the answer to the following question: Is there a difference between not calling getLastError at all and calling getLastError(0, 0)? It's now a mongodb question and not a Go question anymore. Feel free to ask that of course. But if you're not getting the ans

Re: [go-nuts] SetSafe default value in mgo session

2016-08-05 Thread Debraj Manna
Yeah I already asked it in mgo-users forum . I did not get any response from there. So asked it in this forum as I saw quite a few mgo related discussion in golang-nuts

[go-nuts] Re: Namespacing hack using method on empty type

2016-08-05 Thread Christian Joergensen
Hi, For starters, packages can't implement interfaces. Cheers, On Friday, August 5, 2016 at 6:19:31 AM UTC+2, Christoph Berger wrote: > > Are there any advantages over using real packages? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To uns

[go-nuts] Re: Namespacing hack using method on empty type

2016-08-05 Thread paraiso . marc
You just declared a global variable. the standard library does exactly that with http Client. I assume if it is in the std lib I don't see why you shouldn't do that yourself. Le mercredi 3 août 2016 15:19:52 UTC+2, d a écrit : > > Hi all, just saw a piece of software that make large use of metho

Re: [go-nuts] Is there a function in standard lib to convert []T to a []interface{}?

2016-08-05 Thread paraiso . marc
I guess the difference is that a builtin COULD be compile-time type safe. It could reject anything that is not a slice or an array, the same way append is type safe. Le mercredi 3 août 2016 17:51:44 UTC+2, Thomas Bushnell, BSG a écrit : > > On Wed, Aug 3, 2016 at 7:36 AM T L > > wrote: > >> Oft

[go-nuts] Re: IDE for GOLANG

2016-08-05 Thread paraiso . marc
Liteide is the best editor for Go : https://sourceforge.net/projects/liteide/ Le mardi 2 août 2016 14:25:21 UTC+2, kritika...@indiamart.com a écrit : > > Hi, > is there IDE for creating a web service in GOLANG by using Revel framework > which follows MVC architecture. > > i am using Ubuntu ..

[go-nuts] Re: how to apply netutil.LimitListener() to ListenAndServeTLS()'s listener? how to fetch ListenAndServeTLS()'s listener?

2016-08-05 Thread David Marceau
I get what you're saying. I did something similar, but modifying all those structures places you at risk of changing the entire default specified behaviour of the ListenAndServeTLS because you now not only introduced the limitConnections integer, but you in fact brought in other variables/func

[go-nuts] Initialize Variables in case clause of a switch

2016-08-05 Thread dc0d
In Go we can write: if _, ok := input.(*data); ok { //... } Why is it we can't do that in the case clause of a switch statement: switch { case x1,ok:=input.(*data1); ok && otherCond1: case x2,ok:=input.(*data2); ok && otherCond2: } (I've read the language specification - which BTW speaks about

[go-nuts] Connection reset while uploading files - net/http & gin

2016-08-05 Thread Juan Carlos Garcia
Greetings I'm having some trouble while uploading medium-sized files (>6MB) through a POST request. The browser client gives me the error 'Connection reset'. I've tried using both the default *gin.Engine and vanilla http.Server (with ReadTimeout and WriteTimeout in zeros). When the error appear

[go-nuts] Proposal: a better http handler type in x/net

2016-08-05 Thread kdy . 1997 . dev
Currently, if you want to change router package you use, all handlers and middlewares must be fixed. So I propose a universal handler type with net/context and path parameter. Common requirements - net/context - path paramter Example implementation https://godoc.org/github.com/kdy1997/w

[go-nuts] Go API checker

2016-08-05 Thread stable . pseudonym
Hello, I have made some changes to a part of the go standard library. I am testing these to see if they help me do what I need to do (and I haven't found another way to do this which doesn't involve changing the std library). When I build go, I get a nice little error at the end, related to th

Re: [go-nuts] Initialize Variables in case clause of a switch

2016-08-05 Thread Ian Lance Taylor
On Fri, Aug 5, 2016 at 8:57 AM, dc0d wrote: > In Go we can write: > > if _, ok := input.(*data); ok { > //... > } > > Why is it we can't do that in the case clause of a switch statement: > > switch { > case x1,ok:=input.(*data1); ok && otherCond1: > case x2,ok:=input.(*data2); ok && otherCond2: >

Re: [go-nuts] Initialize Variables in case clause of a switch

2016-08-05 Thread Andy Balholm
I’ve wished for it too, but I just use an else/if chain in that case. Andy -- 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.c

Re: [go-nuts] Initialize Variables in case clause of a switch

2016-08-05 Thread Sam Whited
On Fri, Aug 5, 2016 at 11:40 AM, Ian Lance Taylor wrote: > I don't think there is a reason as such. I don't recall anybody ever > suggesting it. I also run into cases where this would make things more readable on occasion; can't think of any examples off the top of my head though. —Sam -- Sam

Re: [go-nuts] Proposal: a better http handler type in x/net

2016-08-05 Thread 'Axel Wagner' via golang-nuts
net/http will start getting support for context in the coming week or so (when go 1.7 comes out), so with "path" being ex tractable from the url field of the request (and, if necessary, put into the context in a middle ware) I don't really see the point of using a non-standard http package for that

Re: [go-nuts] Re: Why doesn't std lib use the method in this article to make err variables constant?

2016-08-05 Thread T L
On Friday, August 5, 2016 at 2:21:53 AM UTC+8, Ian Lance Taylor wrote: > > On Thu, Aug 4, 2016 at 11:19 AM, Manlio Perillo > > wrote: > > Il giorno giovedì 4 agosto 2016 17:54:33 UTC+2, Dave Cheney ha scritto: > >> > >> Fwiw, io.EOf can be converted to a constant, all the tests pass. But > t

[go-nuts] Why can't interface value be constant?

2016-08-05 Thread T L
For an interface value, its internal values will never change. Are there any problems if golang supports constant interface values? -- 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,

Re: [go-nuts] Re: Namespacing hack using method on empty type

2016-08-05 Thread Christoph Berger
Hi Christian, You’re right on this, but my question is about another aspect. The thread starter’s question was about using structs for namespaces (instead of packages). My question is, why would someone want to use empty structs for creating a name space if a package already does this. After al

Re: [go-nuts] Why can't interface value be constant?

2016-08-05 Thread Ian Lance Taylor
On Fri, Aug 5, 2016 at 11:21 AM, T L wrote: > > For an interface value, its internal values will never change. > Are there any problems if golang supports constant interface values? Pedantically, in Go, constants are untyped by default. It doesn't make sense to speak of an untyped interface valu

[go-nuts] Re: Go API checker

2016-08-05 Thread alb . donizetti
At that point, the toolchain is already built. Just ignore that the API checker says. Il giorno venerdì 5 agosto 2016 18:37:33 UTC+2, stable.p...@gmail.com ha scritto: > > Hello, > > I have made some changes to a part of the go standard library. I am > testing these to see if they help me do wha

Re: [go-nuts] Initialize Variables in case clause of a switch

2016-08-05 Thread Rob Pike
It was talked about very early, and eventually made available as a feature of select statements, where grabbing the received value might be necessary. But the argument for switch statements never seemed strong enough. -rob -- You received this message because you are subscribed to the Google Gro

[go-nuts] Re: Go API checker

2016-08-05 Thread Dave Cheney
Add your change to this file https://github.com/golang/go/blob/master/api/except.txt On Saturday, 6 August 2016 02:37:33 UTC+10, stable.p...@gmail.com wrote: > > Hello, > > I have made some changes to a part of the go standard library. I am > testing these to see if they help me do what I need t

[go-nuts] gob-encoding pointer to zero

2016-08-05 Thread Alex Flint
Is it intended that gob-encoding a pointer to an integer with value equal to zero decodes as a nil pointer? I was expecting to get back a non-nil pointer to an integer with value zero. https://play.golang.org/p/UUN0UFEeIN I understand that gob omits zero values but my understanding was that a non

Re: [go-nuts] gob-encoding pointer to zero

2016-08-05 Thread Rob Pike
Working as intended. The model is that if it's a zero, there's nothing to send. -rob On Sat, Aug 6, 2016 at 8:08 AM, Alex Flint wrote: > Is it intended that gob-encoding a pointer to an integer with value equal > to zero decodes as a nil pointer? I was expecting to get back a non-nil > pointer

[go-nuts] Channels not working

2016-08-05 Thread Jon Strauss
Hello, I have the following code: package main import "fmt" import "encoding/hex" import "os" func main() { var bytes []byte var channel chan []byte file,_ := os.OpenFile("/dev/random", os.O_RDONLY, 0) bytes = make([]byte,20) _, _ = file.Read(bytes) ch

[go-nuts] Re: Channels not working

2016-08-05 Thread Dave Cheney
Please check your errors. On Saturday, 6 August 2016 08:38:54 UTC+10, Jon Strauss wrote: > > Hello, > I have the following code: > > package main > > import "fmt" > import "encoding/hex" > import "os" > > func main() { >var bytes []byte >var channel chan []byte > >file,_ :=

[go-nuts] Re: Channels not working

2016-08-05 Thread Dave Cheney
Your program exits because the channel is buffered, so the main goroutine exits immediately once it has sent the value to the channel. Once the main goroutine returns, the program will exit. On Saturday, 6 August 2016 08:38:54 UTC+10, Jon Strauss wrote: > > Hello, > I have the following code: >

[go-nuts] Re: Channels not working

2016-08-05 Thread Jon Strauss
Great. Thank you. I fixed it by adding a second channel to indicate worker success. On Friday, August 5, 2016 at 3:47:09 PM UTC-7, Dave Cheney wrote: > > Your program exits because the channel is buffered, so the main goroutine > exits immediately once it has sent the value to the channel. Once

Re: [go-nuts] Proposal: a better http handler type in x/net

2016-08-05 Thread msilverlock via golang-nuts
Agreed with Axel. http.Request will grow a Context() context.Context field, without breaking the existing http.Handler interface. Routers out there doing otherwise should come back around to using a common standard-lib interface. On Friday, August 5, 2016 at 10:30:21 AM UTC-7, Axel Wagner wrot

[go-nuts] Re: Channels not working

2016-08-05 Thread Dave Cheney
You could simplify your program by removing the go statement. There is no concurrency if one goroutine hands one piece work off to another then sleeps for the result; it's simpler to just do the work yourself. -- You received this message because you are subscribed to the Google Groups "golan

Re: [go-nuts] Proposal: a better http handler type in x/net

2016-08-05 Thread 강동윤
I forgot about context in go 1.7 Sorry for my mistake. 2016년 8월 6일 (토) 오전 8:48, 님이 작성: > Agreed with Axel. > > http.Request will grow a Context() context.Context field, without breaking > the existing http.Handler interface. Routers out there doing otherwise > should come back around to using a c

[go-nuts] Proposal: a better http handler type in x/net

2016-08-05 Thread 강동윤
I forgot about context in go 1.7 Sorry for my mistake. -- 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,

[go-nuts] Re: Go package management proposal process

2016-08-05 Thread Dave Cheney
Hello, I wish to nominate myself to be part of the working group. I have written up my position statement here: https://gist.github.com/davecheney/48c07d20f8cf38cce61c940d7bd55644 I am seeking a second for my nomination. Thank you Dave On Friday, 29 July 2016 17:46:01 UTC+10, Peter Bourgon w

[go-nuts] Re: Go package management proposal process

2016-08-05 Thread James Pirruccello
I'd be happy to second your nomination. On Saturday, August 6, 2016 at 12:58:48 AM UTC-4, Dave Cheney wrote: > > Hello, > > I wish to nominate myself to be part of the working group. I have written > up my position statement here: > > https://gist.github.com/davecheney/48c07d20f8cf38cce61c940d7bd

[go-nuts] Re: ANNOUNCE: gini

2016-08-05 Thread Markus Zimmermann
Nice. I put your solver on my benchmarking list for our use-cases. I hope I get to that in the following months. I am exceptionally excited to see a pure Go SAT solver :-) Are you trying to get in the next SAT competition? I created an issue in the tracker about resolving the go-getable issue.