[go-nuts] Re: formatting question/issue

2018-04-10 Thread Henry
I believe the first example (the one without the last comma) is when you want to put everything on the same line. The second example (the one with the last comma) is when you want to split the items into separate lines. They each have different uses. It is awkward to see this `{ 'A', 'B', 'C',

[go-nuts] Re: Anyway to print the exact cql query being executed against db

2018-04-10 Thread Raju
By the way, I am using gocql package - https://github.com/gocql/gocql On Tuesday, April 10, 2018 at 9:39:23 PM UTC-7, Raju wrote: > > Hi, > > Assuming my query using an iterator looks like this. Is there any way to > print the exact cql query that is finally executed on Cassandra side when >

[go-nuts] Anyway to print the exact cql query being executed against db

2018-04-10 Thread Raju
Hi, Assuming my query using an iterator looks like this. Is there any way to print the exact cql query that is finally executed on Cassandra side when iter.Scan() is called? My iter query is returning empty results, but when I manually search using the cql query in my database table in

Re: [go-nuts] TCP connection reuse when doing HTTP

2018-04-10 Thread Sun Frank
Hi Alex: thanks for your answer, really helped me. As you mentioned, the connection was indeed closed by the server side: in the packages captured, the server side sent the FIN first; seems like that python's HTTP module and nginx all close the conenction on server side i wrote a simple http

Re: [go-nuts] Sorting slice of structs

2018-04-10 Thread Michael Jones
We all saw it immediately ... because ... we remember having done it too. :-) On Tue, Apr 10, 2018 at 11:38 AM, Sankar wrote: > ah damn. Thanks everyone :) > > On Wednesday, 11 April 2018 00:05:00 UTC+5:30, Jan Mercl wrote: >> >> >> On Tue, Apr 10, 2018 at 8:29 PM

[go-nuts] Re: [ANN] Gomail v2: sending emails faster

2018-04-10 Thread leeas via golang-nuts
Is there a way to send an email AS a group member? Currently, I am able to do so via the Gmail Web Client. But I can't figure out a way to do it via my 3rd party client (Airmail 3), or standard Go (via net/smtp). Hence, I was wondering if there was a way to send as a group. On Wednesday,

Re: [go-nuts] Fixing the version of protoc-gen-go

2018-04-10 Thread Amit Chandak
Thanks Stephan, that worked Amit On Tuesday, March 27, 2018 at 5:38:39 AM UTC-7, Stephan Renatus wrote: > > Hi Amit, > > have you tried this? > > go install ./vendor/github.com/golang/protobuf/protoc-gen-go > > Also note that you might have to add a required statement to Gopkg.toml > to

Re: [go-nuts] Sorting slice of structs

2018-04-10 Thread Sankar
ah damn. Thanks everyone :) On Wednesday, 11 April 2018 00:05:00 UTC+5:30, Jan Mercl wrote: > > > On Tue, Apr 10, 2018 at 8:29 PM Sankar > wrote: > > > Any help on how I can get arr sorted in the above code ? > > Just a typo: https://play.golang.org/p/vhbo8OIrh-H > > --

Re: [go-nuts] Sorting slice of structs

2018-04-10 Thread Jan Mercl
On Tue, Apr 10, 2018 at 8:29 PM Sankar wrote: > Any help on how I can get arr sorted in the above code ? Just a typo: https://play.golang.org/p/vhbo8OIrh-H -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group.

Re: [go-nuts] Sorting slice of structs

2018-04-10 Thread Burak Serdar
Simple mistake. You have: sort.Slice(arr, func(i, j int) bool { return arr[i].X < arr[i].X }) Instead use: sort.Slice(arr, func(i, j int) bool { return arr[i].X < arr[j].X }) On Tue, Apr 10, 2018 at 12:28 PM, Sankar wrote: > Hi > > I have the following code: > >

Re: [go-nuts] Sorting slice of structs

2018-04-10 Thread Michael Jones
Change I i to I j On Tue, Apr 10, 2018 at 11:29 AM Sankar wrote: > Hi > > I have the following code: > > type Point struct { > Xint > Name string > } > > arr := []Point{ > Point{1, "One"}, > Point{3, "Three"}, > Point{2, "Two"}, > Point{4, "Four"}, > } > >

[go-nuts] Sorting slice of structs

2018-04-10 Thread Sankar
Hi I have the following code: type Point struct { Xint Name string } arr := []Point{ Point{1, "One"}, Point{3, "Three"}, Point{2, "Two"}, Point{4, "Four"}, } log.Println("Before Sorting: ", arr) sort.Slice(arr, func(i, j int) bool { return arr[i].X < arr[i].X }) log.Println("After Sorting:

Re: [go-nuts] net.Conn not returning error upon Write after being closed from far side.

2018-04-10 Thread Alex Efros
Hi! On Tue, Apr 10, 2018 at 07:58:29AM -0700, pierspowlesl...@gmail.com wrote: > I'm trying to understand what is going on under the hood here. SO_LINGER (see socket(7)) delay happens. Add this after Accept(): conn, err := listener.Accept() if err == nil { err =

Re: [go-nuts] net.Conn not returning error upon Write after being closed from far side.

2018-04-10 Thread Janne Snabb
Your TCP FIN is still in transit or not yet processed by the other TCP stack when you issue the first write. TCP is not synchronous even if running on same host. Janne Snabb sn...@epipe.com On 2018-04-10 17:58, pierspowlesl...@gmail.com wrote: > Hi > > I'm trying to understand what is going

[go-nuts] Re: After one goroutine completed, does the thread its binded will be destroyed?

2018-04-10 Thread Pelon Lee
Thanks you! I'll see that code. 在 2018年4月10日星期二 UTC+8上午7:32:51,Keith Randall写道: > > Tamás is right. In the case you show, M1 will pick up G2 and work on it. > In general, the M (OS thread) finds another goroutine to run, and if it > can't find one it parks itself until more goroutines show

[go-nuts] net.Conn not returning error upon Write after being closed from far side.

2018-04-10 Thread pierspowlesland
Hi I'm trying to understand what is going on under the hood here. I would expect a net.Conn after being closed from the far side, to issue an error if the near side then tries to write to it. On my local machine an error is returned on the second write, on the go playground all writes

Re: [go-nuts] TCP connection reuse when doing HTTP

2018-04-10 Thread Alex Efros
Hi! On Tue, Apr 10, 2018 at 06:14:46AM -0700, Sun Frank wrote: > my question is how to reuse underlying TCP connection when doing a lot of > frequent short HTTP requests using golang? This happens by default: https://play.golang.org/p/XnzQoGqQlno > they say the key is to close resp.Body Yes,

[go-nuts] TCP connection reuse when doing HTTP

2018-04-10 Thread Sun Frank
Hi guys: my question is how to reuse underlying TCP connection when doing a lot of frequent short HTTP requests using golang? I tried things from stackoverflow and other blogs including: https://stackoverflow.com/questions/17948827/reusing-http-connections-in-golang

Re: [go-nuts] formatting question/issue

2018-04-10 Thread Jan Mercl
On Tue, Apr 10, 2018 at 1:32 AM Alex Dvoretskiy wrote: > Why there is no difference if the last comma exists? Because the language specification allows to omit the last comma before the closing '}': LiteralValue = "{" [ ElementList [ "," ] ] "}" . See: