Re: [go-nuts] Re: Idiomatic way to signal error using websockets

2016-07-07 Thread Johann Höchtl
Am Donnerstag, 7. Juli 2016 16:25:38 UTC+3 schrieb Bogdan Bursuc: > > The websocket protocol is a TCP socket in the end after you establish the > handshake, this means you will send raw data through it and you can make > the protocol and errors as you want. > There will be no status code anymor

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

2016-07-07 Thread Chris Broadfoot
Hello gophers, We have just released go1.7rc1, a release candidate for Go 1.7. It is cut from release-branch.go1.7 at the revision tagged go1.7rc1. Please help us by testing your Go programs with the release, and report any problems using the issue tracker: https://golang.org/issue/new You ca

[go-nuts] log.Logger, Why is this not an interface?

2016-07-07 Thread zgershman
Hey All, Originally asked on twitter but a more long-form medium is required to answer this question. I've recently been working on adding logging to a library and have been replacing what was once a custom logging interface with just *log.Logger. In so doing, I removed my ability to mock the l

Re: [go-nuts] New Context method in http.Request, what can we do with it?

2016-07-07 Thread Dave Cheney
1.7 will be released in August. You can try Go 1.7 today in beta form and I just say the first release candidate has been tagged and will be out in the next 24 hours. On Friday, 8 July 2016 13:30:00 UTC+10, jonathan...@gmail.com wrote: > > Anyone have an idea when 1.7 will be out? > > On Thursda

Re: [go-nuts] New Context method in http.Request, what can we do with it?

2016-07-07 Thread jonathan . gaillard
Anyone have an idea when 1.7 will be out? On Thursday, July 7, 2016 at 4:08:51 PM UTC-7, Shawn Milochik wrote: > > Some really important and use stuff. Check this out: > > https://blog.golang.org/context > > > -- You received this message because you are subscribed to the Google Groups "golang-

[go-nuts] Why should Golang stop appending certificate file after finding one

2016-07-07 Thread Keping Hu
As the issue title, I don't quite understand why Golang stop appending certificate file after finding one, see https://golang.org/src/crypto/x509/root_unix.go: func initSystemRoots() Doesn't it possible that different certificates stored in different directory or different certs-bundle file?

[go-nuts] Re: Using "map index expressions" as the value for a range loop

2016-07-07 Thread keith . randall
I don't think there are any. Because you can do it doesn't mean you should. It's incredibly confusing for readers (hence the confusion in this thread). On Thursday, July 7, 2016 at 8:52:06 AM UTC-7, Kyle Stanly wrote: > > So, what would be the appropriate use-cases for this; I.E, using a map

Re: [go-nuts] New Context method in http.Request, what can we do with it?

2016-07-07 Thread Shawn Milochik
Some really important and use stuff. Check this out: https://blog.golang.org/context -- 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...@goo

[go-nuts] New Context method in http.Request, what can we do with it?

2016-07-07 Thread Tyler Compton
I'm really excited to see context.Context become a first class citizen in Go 1.7. After using context, it feels like a natural way to write Go network code and it fits naturally in the standard library. I'm trying to figure out how I can improve existing code with the new features that come wit

[go-nuts] [ANN] Nexer 1.0.1 code name: Dexter

2016-07-07 Thread Diego Cena
Hi all! I'm happy to announce a new release of nexer, available in github. https://github.com/diegohce/nexer/releases/latest What's new?: - Added tunnel to pip service (python packages index) See docs here: https://github.com/diegohce/nexer/blob/master/README.md -- You received this me

[go-nuts] Re: Using "map index expressions" as the value for a range loop

2016-07-07 Thread Kyle Stanly
So, what would be the appropriate use-cases for this; I.E, using a map index expression as the value? On Thursday, July 7, 2016 at 10:05:42 AM UTC-4, Kyle Stanly wrote: > > I noticed that the specification states: > > "As with an assignment, if present the operands on the left must be > addressa

[go-nuts] Re: java.lang.UnsatisfiedLinkError: Native method not found: go.Universe.init:()V

2016-07-07 Thread Elias Naur
Thanks for reporting this. It should be fixed with https://go-review.googlesource.com/#/c/24800/ - elias On Thursday, July 7, 2016 at 8:45:47 AM UTC+2, Lewis Deng wrote: > > bind/genjava.go > > if g.pkg == nil { > g.Printf("clazz = (*env)->FindClass(env, %q);\n", "go/Universe$"+ > s.obj.Name())

Re: [go-nuts] Using "map index expressions" as the value for a range loop

2016-07-07 Thread Jan Mercl
On Thu, Jul 7, 2016 at 4:41 PM Jesse McNelis wrote: > Looks fine to me. The k in m[k] is the value of k before the assignment. > > So the value at m["foo"] is assigned to m[""] and the value at m["bar"] is assigned to m["foo"] Took me a while to run it through a mind emulator, but you're right.

Re: [go-nuts] Using "map index expressions" as the value for a range loop

2016-07-07 Thread Jesse McNelis
On 8 Jul 2016 12:19 a.m., "Jan Mercl" <0xj...@gmail.com> wrote: > > I did not expect the result I've got: https://play.golang.org/p/ECno0PVdBF > > It seems like a bug to me. > Looks fine to me. The k in m[k] is the value of k before the assignment. So the value at m["foo"] is assigned to m[""] a

[go-nuts] Re: Go application hanging and throwing Proxy error: Request Canceled or I/O timeout

2016-07-07 Thread dkbalachandar
Thanks everyone for your valuable suggestions. I tried all the solutions but nothing worked out. Then I reviewed the dependent system changes and got to know that their recent changes caused all these issues. So its nothing to do with the Go application. Apologies for the confusion. On Tuesda

Re: [go-nuts] Using "map index expressions" as the value for a range loop

2016-07-07 Thread Konstantin Khomoutov
On Thu, 07 Jul 2016 14:19:17 + Jan Mercl <0xj...@gmail.com> wrote: > > for k, m[k] := range m {...} > > > > Apparently is valid Go syntax, however what are the semantics > > behind this? > > It is not a valid Go syntax. The short variable declaration syntax > requires variable names on its le

Re: [go-nuts] Using "map index expressions" as the value for a range loop

2016-07-07 Thread Jan Mercl
On Thu, Jul 7, 2016 at 4:06 PM Kyle Stanly wrote: > for k, m[k] := range m {...} > > Apparently is valid Go syntax, however what are the semantics behind this? It is not a valid Go syntax. The short variable declaration syntax requires variable names on its left side. You probably meant '=' inst

[go-nuts] Using "map index expressions" as the value for a range loop

2016-07-07 Thread Kyle Stanly
I noticed that the specification states: "As with an assignment, if present the operands on the left must be addressable or map index expressions; they denote the iteration variables." Here is the thing I am having trouble imagining... if the iterator keeps a snapshot of the map at the time th

Re: [go-nuts] Error vs. Panic: Should functions like strings.Repeat return an error value?

2016-07-07 Thread Lucio
On Thursday, 7 July 2016 01:45:17 UTC+2, Dave Cheney wrote: > > Why panic, the method returns an error value that can be used to tell the > caller they made a mistake. There's a subtle line there and Go's philosophy is not firmly on one side of it. I think the key phrase would have to be: "this

Re: [go-nuts] Re: Idiomatic way to signal error using websockets

2016-07-07 Thread Bogdan Bursuc
The websocket protocol is a TCP socket in the end after you establish the handshake, this means you will send raw data through it and you can make the protocol and errors as you want. There will be no status code anymore, because what you send through that connection wont be http anymore. On Thu,

[go-nuts] Re: Idiomatic way to signal error using websockets

2016-07-07 Thread Viktor Kojouharov
You have to define your protocol that goes through the websocket. For example, the json-rpc protocol has a special error field when an error occurs. On Thursday, July 7, 2016 at 10:45:04 AM UTC+3, Johann Höchtl wrote: > > I am using the gorilla websocket implementation. I am also new to > webso

Re: [go-nuts] Error vs. Panic: Should functions like strings.Repeat return an error value?

2016-07-07 Thread 'Axel Wagner' via golang-nuts
go's panic correspond, if anything, to unchecked exceptions in Java and they should be treated as such, i.e. they should never be caught and only be thrown on a clear programmer error. And once you restrict yourself to checked exceptions, there really isn't an advantage of a try-catch over an if er

[go-nuts] Make a multi part request from a stringified body payload

2016-07-07 Thread Mayank Jha
I have the payload, "--3c1e04950334427b Content-Disposition: form-data; name="certificate"; filename="new-cert.pem" Content-Type: application/octet-stream -BEGIN RSA PRIVATE KEY- -END RSA PRIVATE KEY- -BEGIN CERTIFICATE- -END CERTIFICATE-

Re: [go-nuts] Error vs. Panic: Should functions like strings.Repeat return an error value?

2016-07-07 Thread Martin Geisler
On Thu, Jul 7, 2016 at 9:44 AM, Dave Cheney wrote: > Hi Martin, > > Go doesn't have exceptions, it really doesn't. Some people like to pretend > that panic/recover are exceptions, but really they are not [1]. Yes, sure, they're called something else :-) But they behavior matches what you get with

Re: [go-nuts] pure-Go MATLAB file I/O package ?

2016-07-07 Thread Seb Binet
Maxim, thanks for taking the time to answer me. On Thu, Jul 7, 2016 at 12:52 PM, Maxim Khitrov wrote: > Maybe you already know this, but that PDF seems to cover the format > that was used by MATLAB Version 5 (R8). Versions since R2006b use an > HDF5-based format: > > https://www.mathworks.com/h

Re: [go-nuts] pure-Go MATLAB file I/O package ?

2016-07-07 Thread Maxim Khitrov
Maybe you already know this, but that PDF seems to cover the format that was used by MATLAB Version 5 (R8). Versions since R2006b use an HDF5-based format: https://www.mathworks.com/help/matlab/import_export/mat-file-versions.html Unless you only need to work with the old format, you should look

Re: [go-nuts] String Split Question

2016-07-07 Thread Ignazio Di Napoli
On Thursday, July 7, 2016 at 12:05:27 AM UTC+2, Justin Israel wrote: > > https://play.golang.org/p/fOFT2voh6l >> > > That's pretty sweet. > Pretty sweet indeed, but it's worth saying that if the string is [field 1][field 2][][field 4] the result is ["field 1", "field 2", "field4"], ignoring the

[go-nuts] pure-Go MATLAB file I/O package ?

2016-07-07 Thread Seb Binet
hi there, before I go ahead and implement it, has anyone released a pure-Go read/write package for MATLAB files ? https://www.mathworks.com/help/pdf_doc/matlab/matfile_format.pdf I've found: https://github.com/ready-steady/mat but that package is actually using the C-API exposed by a MATLAB in

Re: [go-nuts] golang time.Duration calculation

2016-07-07 Thread Jakob Borg
Or, as an alternative, use the built in methods to get seconds in floating point: https://play.golang.org/p/euWSlfDf3Y //jb 2016-07-07 0:20 GMT+02:00 Dan Kortschak : > Type convert *prior* to the division. > > https://play.golang.org/p/7cwTFu_3im > > On Wed, 2016-07-06 at 15:01 -0700, Tong Sun w

[go-nuts] Idiomatic way to signal error using websockets

2016-07-07 Thread Johann Höchtl
I am using the gorilla websocket implementation. I am also new to websockets. When I want to signal an error on an http-connection I used http.Error which allwed me to set an http status error code, sets mime type to text/plain an writes an error message to the receiver. How am I supposed to si

Re: [go-nuts] Error vs. Panic: Should functions like strings.Repeat return an error value?

2016-07-07 Thread Dave Cheney
Hi Martin, Go doesn't have exceptions, it really doesn't. Some people like to pretend that panic/recover are exceptions, but really they are not [1]. Thanks Dave 1. https://golang.org/doc/faq#exceptions On Thursday, 7 July 2016 17:36:30 UTC+10, Martin Geisler wrote: > > Hi Dave > > On Thu, J

Re: [go-nuts] Error vs. Panic: Should functions like strings.Repeat return an error value?

2016-07-07 Thread Martin Geisler
Hi Dave On Thu, Jul 7, 2016 at 2:08 AM, Dave Cheney wrote: > If this function panic'd then people who raise issues to make it not panic, > or they would work around it with recover(), both of which would be in less > tested code paths. As a newcomer to Go, it's fun to me that you call using reco