[go-nuts] if i catch resp.StatusCode != http.StatusOK and return early from my function, do i still have to close resp.Body??

2018-01-27 Thread evan
in the code snippet below which is inside a function, is "defer resp.Body.Close() " in the appropriate position? am i required to always do a resp.Body.Close()? ... resp, err := client.Do(req) log.Printf("resp: %+v\n", resp) if resp.StatusCode != http.StatusOK { return

[go-nuts] why defer function with parentheses

2018-01-27 Thread Tamás Gulácsi
Defer defers the esecutiin of the following expression, but not the evaluation of the arguments. So "defer fn(a==1)" will call fn when this function exists, with a bool that is true iff a _was_ 1 when the defer was registered. -- You received this message because you are subscribed to the

[go-nuts] Re: if you use sql.NullXYZ, what else do you find yourself doing to make coding easier (or make your code more readable, etc...)

2018-01-27 Thread evan
thanks! seems to be working out for me too so far. makes me wonder what the use cases might be for sql.NullXYZ and other similar types from non-stdlib packages other than making the connection to db nulls more obvious maybe? On Saturday, January 27, 2018 at 10:12:23 PM UTC+8, Reinhard Luediger

Re: [go-nuts] Re: Web Framework for Beginners

2018-01-27 Thread Lucio
On Saturday, 27 January 2018 23:49:19 UTC+2, Pat Farrell wrote: > > > > On Saturday, January 27, 2018 at 4:34:39 PM UTC-5, Lars Seipel wrote: >> >> We're talking about a beginning Go programmer that has yet to learn how >> some of the more advanced parts of the language fit together properly.

[go-nuts] why defer function with parentheses

2018-01-27 Thread Flying
example : fn := func() { fmt.Println(10) } defer fn() my question is why use defer fn() not defer fn when we use fn() here doesn't it mean call it now ??? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

[go-nuts] Re: projects using net/http

2018-01-27 Thread matthewjuran
Hi Keith, Can you share some specific things you’d like to see already implemented? Serving JSON data and web pages to a browser seems like a straightforward project with the standard library examples and resources available with Internet search engines. Here’s an official net/http server

Re: [go-nuts] Re: Web Framework for Beginners

2018-01-27 Thread matthewjuran
> > Interesting. Does this work on all browsers on all platforms? Untested here. I've seen it work on macOS with Safari, Chrome, and Firefox. The || is to support how different browsers indicate a back button press / back cache load. Matt On Saturday, January 27, 2018 at 3:49:19 PM UTC-6,

Re: [go-nuts] Re: "Try Go" in golang.org stopped working properly?

2018-01-27 Thread Andrew Bonventre
I flushed the cache and now see the correct output on https://play.golang.org/p/-MKUWeDBml7 On Sat, Jan 27, 2018 at 4:42 PM Andrew Bonventre wrote: > Looks like it. I’ll check it out. > On Sat, Jan 27, 2018 at 3:20 PM Ian Lance Taylor wrote: > >> [

Re: [go-nuts] Shared stdlib questions

2018-01-27 Thread Ian Lance Taylor
On Sat, Jan 27, 2018 at 1:44 AM, Serhat Şevki Dinçer wrote: > > On Manjaro 64-bit with go 1.9.3 I am doing: > go install -gcflags '-B -s' -ldflags '-s -w' -buildmode shared std > > I get two warnings many times: > go/src/unicode/casetables.go:17:11: redundant type: CaseRange >

Re: [go-nuts] Re: Web Framework for Beginners

2018-01-27 Thread Pat Farrell
On Saturday, January 27, 2018 at 4:34:39 PM UTC-5, Lars Seipel wrote: > > We're talking about a beginning Go programmer that has yet to learn how > some of the more advanced parts of the language fit together properly. Sorry, no. Folks coming from other languages want to know how to do the

Re: [go-nuts] Re: "Try Go" in golang.org stopped working properly?

2018-01-27 Thread Andrew Bonventre
Looks like it. I’ll check it out. On Sat, Jan 27, 2018 at 3:20 PM Ian Lance Taylor wrote: > [ +andybons, bradfitz ] > > Looks like something has gone wrong with the play.golang.org caching. > > Ian > > On Sat, Jan 27, 2018 at 10:18 AM, wrote: > > I see the

Re: [go-nuts] Re: Web Framework for Beginners

2018-01-27 Thread Lars Seipel
On Thu, Jan 25, 2018 at 01:26:00PM -0800, Florin Pățan wrote: > I'm not saying that we should be against recommending the standard library, > by all means, it's one of the best assets of the language. But maybe it's > time we should think about saying: Start with this framework, insert >

Re: [go-nuts] Re: "Try Go" in golang.org stopped working properly?

2018-01-27 Thread Ian Lance Taylor
[ +andybons, bradfitz ] Looks like something has gone wrong with the play.golang.org caching. Ian On Sat, Jan 27, 2018 at 10:18 AM, wrote: > I see the same thing. Changing even one character fixes the problem. Even > just adding white space to the code. If I copy the

Re: [go-nuts] How to get mount point or device name by directory?

2018-01-27 Thread Matt Harden
syscall.Stat_t does have the Dev field, which is documented by POSIX: https://linux.die.net/man/2/stat: "The st_dev field describes the device on which this file resides. (The major(3) and minor(3) macros may be useful to decompose the device ID in this field.)" In Go we don't have the major and

Re: [go-nuts] Re: [ANN] Go Jupyter kernel and an interactive REPL

2018-01-27 Thread Sebastien Binet
Just to say that neugram.io has also a Jupyter front-end. Here's an example with 'my' high energy physics oriented libraries and Gonum: https://mybinder.org/v2/gh/go-hep/binder/master Now, Go has 3 Jupyter kernels :) -s sent from my droid On Jan 27, 2018 8:18 PM, "Matt Harden"

Re: [go-nuts] Re: [ANN] Go Jupyter kernel and an interactive REPL

2018-01-27 Thread Matt Harden
That's very nice! On Wed, Jan 17, 2018 at 8:29 AM Glen Newton wrote: > Wow! This is great and positions Go better in the 'data science' world! > > Thanks, > Glen > > > On Tuesday, January 16, 2018 at 8:53:39 AM UTC-5, Yu Watanabe wrote: >> >> Hi Gophers, >> >> I developed

[go-nuts] Re: Async process state snapshotting in Golang

2018-01-27 Thread jake6502
A couple of comments. This is probably obvious, but I wanted to point out that matthe...'s code would require *all *access to the map to be synchronized using the mutex. It's a simple and effective solution. One downside to his code is that it holds the lock for the duration of the Copy().

Re: [go-nuts] Re: Any plans to add ASN.1 PER support?

2018-01-27 Thread Matt Harden
It isn't something that is likely to be added to the stdlib. If anything, a library like https://github.com/Logicalis/asn1 might be interested in supporting it / accepting a pull request to add it. On Fri, Jan 12, 2018 at 9:50 AM David Wahlstedt < david.wahlstedt@gmail.com> wrote: > ASN.1 is

[go-nuts] Re: "Try Go" in golang.org stopped working properly?

2018-01-27 Thread jake6502
I see the same thing. Changing even one character fixes the problem. Even just adding white space to the code. If I copy the example from https://golang.org/ to the playground exactly ( https://play.golang.org/p/-MKUWeDBml7 ) it also prints nothing. Strange On Saturday, January 27, 2018 at

[go-nuts] Re: Web Framework for Beginners

2018-01-27 Thread Pat Farrell
On Thursday, January 25, 2018 at 8:38:01 PM UTC-5, matthe...@gmail.com wrote: > > Specific question: how do you handle the user hitting the "back" button on >> their browser? Its very common and a lot of simple approaches don't handle >> it well. > > > This was a problem for me. I force the

Re: [go-nuts] Re: [ANN] gluo v0.0.2 released - Write your Go net/http server once, deploy it everywhere

2018-01-27 Thread Dario Castañé
Sure, that's possible. I will check and see how to implement it properly. Regards, Dario Castañé dario.im[1] On Sat, Jan 27, 2018, at 13:34, anmol via golang-nuts wrote: > What do you think about offering a second variant to allow passing > in the http server? It's possible one may want to set

[go-nuts] Re: [ANN] go-resty v1.1 released - Simple HTTP and REST client library

2018-01-27 Thread matthewjuran
Hi Jeeva, Thanks for sharing go-resty here. I’d like to mention that my input about struct embedding may not be valid. It was pointed out to me previously when I made a similar suggestion that in library design embedding exports all of the embedded type’s methods, so you may have those named

[go-nuts] gomobile bind -target=ios ld: framework not found OpenGL

2018-01-27 Thread jpteasdale
I'm having a problem building an ios framework that depends on a OpenGL library. if this is the file: package gfx import ( "github.com/goxjs/gl" ) func test() { gl.Clear(gl.COLOR_BUFFER_BIT) } This is the build output: gomobile bind -target=ios gomobile: go install

[go-nuts] if you use sql.NullXYZ, what else do you find yourself doing to make coding easier (or make your code more readable, etc...)

2018-01-27 Thread 'Reinhard Luediger' via golang-nuts
For me it works perfect when I just define each nullable field as a pointer in the struct which represents a da base record. If the struct field is nil it will be null in the database and json encoding handles these fields also correctly -- You received this message because you are

[go-nuts] Re: [ANN] gluo v0.0.2 released - Write your Go net/http server once, deploy it everywhere

2018-01-27 Thread anmol via golang-nuts
What do you think about offering a second variant to allow passing in the http server? It's possible one may want to set limits or other configuration on the HTTP server instead of using the default http server. On Thursday, January 25, 2018 at 6:42:03 PM UTC-5, Dario Castañé wrote: > > I'm

[go-nuts] ssh cause db disconnect

2018-01-27 Thread tuanhoanganh
Hello. I have db connect open before run ssh command. But after run ssh command db connect will be disconnect Is there anyway to fix it. Thanks you very much. Tuan -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

[go-nuts] Re: Table Driven Test (TDT) and log only failed test case

2018-01-27 Thread Jérôme LAFORGE
Of course, that was I already did. But I talk about the log into function I want to test (in the example of playground: func IsBuggyEven) . see: https://play.golang.org/p/OWnEntLwfXa check 0 is even or odd, but I want see this log only for fail test case (i.e when i == 5) check 2 is even or

[go-nuts] "Try Go" in golang.org stopped working properly?

2018-01-27 Thread Eyal Posener
When I "Run", can't see the proper output, just "Program exited". Only after changing "Hello World" to another example and then back to "Hello World" I see the right output: Hello, 世界 Program exited. -- You received this message because you are subscribed to the Google Groups "golang-nuts"

[go-nuts] Shared stdlib questions

2018-01-27 Thread Serhat Şevki Dinçer
Hi, On Manjaro 64-bit with go 1.9.3 I am doing: go install -gcflags '-B -s' -ldflags '-s -w' -buildmode shared std I get two warnings many times: go/src/unicode/casetables.go:17:11: redundant type: CaseRange go/src/vendor/golang_org/x/net/http2/hpack/tables.go:131:13: redundant type: HeaderField

[go-nuts] Table Driven Test (TDT) and log only failed test case

2018-01-27 Thread Tamás Gulácsi
Use subtest (t.Run) -- 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