[go-nuts] http.Transport and too many connection problem.

2016-08-25 Thread bronze man
As I can see from the comment of http.Transport : // Transports should be reused instead of created as needed. The comment telled me that I need reuse the transports. But i am writing a rpc system that the caller can pass different dialler to make http request. It almost impossible for my rpc

Re: [go-nuts] Syntax errors involving compound literals

2016-08-25 Thread sbkim via golang-nuts
On Wednesday, August 24, 2016 at 10:22:22 PM UTC-7, Ian Lance Taylor wrote: > > On Wed, Aug 24, 2016 at 9:21 PM, sbkim via golang-nuts > wrote: > > Hello group, > > > > Why are the following snippets errors? > > > > https://play.golang.org/p/mgEYMNNw9h > > type

[go-nuts] Confused about defer

2016-08-25 Thread dc0d
Assuming we have this test: func TestRecover(t *testing.T) { f := func() (interface{}, error) { panic(`TEST`) } r, e := Recover(f) t.Log(r, e) } And two versions of *Recover* function. Version 1: func Recover(f func() (interface{}, error)) (interface{}, error) { var result interface{}

Re: [go-nuts] Re: text/scanner: scan() vs peek()

2016-08-25 Thread DrGo
Thanks Sam, I managed without a token_peek(). It just leads to more verbose code with calls to scan() and switches everywhere. On Thursday, August 25, 2016 at 10:52:54 PM UTC+1, Sam Whited wrote: > > On Thu, Aug 25, 2016 at 2:09 PM, DrGo > wrote: > > Ok! So my original

Re: [go-nuts] Re: text/scanner: scan() vs peek()

2016-08-25 Thread Sam Whited
On Thu, Aug 25, 2016 at 2:09 PM, DrGo wrote: > Ok! So my original post was not clear. Let us say you just executed scan() > twice on this string: a= x > As expected, Scan() returned scanner.Ident for a, followed by a rune > indicating the = sign. > Now, peek() will

Re: [go-nuts] Why does context.CancelFunc exist?

2016-08-25 Thread Sam Whited
On Thu, Aug 25, 2016 at 2:08 PM, Nate Finch wrote: > The type seems unnecessary. It doesn't actually do anything different than > a regular func(). You are correct that the behavior of the function doesn't differ, but then again behavior isn't necessarily the point of the

[go-nuts] Go protocol proxy, best practices

2016-08-25 Thread Tamás Gulácsi
Check out go4.org/syncutil for Gate to limit concurrency with ease. -- 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

[go-nuts] Why does context.CancelFunc exist?

2016-08-25 Thread Nate Finch
The type seems unnecessary. It doesn't actually do anything different than a regular func(). Does it just exist to give a place for common documentation for each of the methods that use it? IMO, the With* functions would be more clear if they didn't use a named type for func(), because now

[go-nuts] Re: text/scanner: scan() vs peek()

2016-08-25 Thread Jim Robinson
I'll admit to not understanding how your question and code example mesh, but as far as I can tell Scanner.Peek is working as it is documented in the API, it returns the rune w/o advancing: https://play.golang.org/p/DgzRcWeTRI -- You received this message because you are subscribed to the

Re: [go-nuts] text/scanner: scan() vs peek()

2016-08-25 Thread Sam Whited
On Thu, Aug 25, 2016 at 12:55 PM, DrGo wrote: > Should not scanner.Peek do whatever scanner.Scan does just without advancing > the scanner? It does; scanner.Scan returns the next rune in the string and scanner.Peek returns the next rune in the string without advancing the

[go-nuts] text/scanner: scan() vs peek()

2016-08-25 Thread DrGo
Hello, Perhaps I am misunderstanding the purpose or do not know how to optimally use this package, but the way I see it scanner.peek() is not doing what I expect it to do: return the next non-whitespace token (e.g., scanner.Ident, scanner.Int etc) without advancing the scanner. Instead it

[go-nuts] Re: Search for Another JSON Package

2016-08-25 Thread dc0d
Yes; I was super frustrated with big integers in JSON & your packages saved me big time! Thanks a lot! On Thursday, August 25, 2016 at 3:19:19 PM UTC+4:30, Ugorji Nwoke wrote: > > I just checked the issue you created: > https://github.com/ugorji/go/issues/168 . I see you already closed it as >

Re: [go-nuts] Re: Why a **T value can't call methods of *T and T if a *T value can call methods of T?

2016-08-25 Thread Ian Lance Taylor
On Thu, Aug 25, 2016 at 3:09 AM, T L wrote: > > On Thursday, August 25, 2016 at 5:41:32 AM UTC+8, xiio...@gmail.com wrote: >> >> It doesn't/wouldn't seem to be any technical issue implementing methods on >> any depth of pointer type .. as demonstrated in the unsafe example

[go-nuts] Re: Panic when calling fmt.Printnl() on string (segmentation violation)

2016-08-25 Thread Dave Cheney
Whenever you suspect memory corruption, try the race detector. Can you also please post the full panic message, you cut off the important part On Friday, 26 August 2016 01:11:49 UTC+10, arb...@gmail.com wrote: > > Hello everyone, > > My application occasionally crash when processing string

Re: [go-nuts] Go protocol proxy, best practices

2016-08-25 Thread Zlatko Čalušić
Hello, it would be hard to give you a complete solution without knowing many more details about your application. So to comment on just one part, spawning goroutine, or two, per connection. It is absolutely THE correct way in Go. All those goroutines will be effectively mapped to system

[go-nuts] Re: totalling a column in a html template.

2016-08-25 Thread Val
As you may have guesses, the html/package is not designed to perform such clever calculations. It handles only the html rendering logic. You have 2 pretty good fallbacks actually : either precalculate and feed values to the template (server-side), or use javascript (client-side). Cheers Val On

[go-nuts] Go protocol proxy, best practices

2016-08-25 Thread kvratkin
Hi all, I'm looking for some good practices of concurrent programming in Go. My software works and even customer satisfied :). But I feel job doesn't done perfectly. The task was to convert some well documented but proprietary protocol to Diameter with custom dictionary. But my feelings

[go-nuts] Re: Is it possible to create Application server in Golang?

2016-08-25 Thread madars . vitolins
There is one already, check Enduro/X ASG (https://github.com/endurox-dev/endurox, https://github.com/endurox-dev/endurox-go). You can create a modules which basically is stand alone Go binaries which does the Enduro/X organized IPC. Enduro/X monitors the processes, load balances the requests,

[go-nuts] totalling a column in a html template.

2016-08-25 Thread Carl Ranson
HI All, been playing with using go to pull data from a few sources and serve a consolidated view as a webpage. I've got most of it going ok, but hitting a wall trying to do a totals row in an output table. anyone know if the html/template package is able to do this? the fallback is to

[go-nuts] Panic when calling fmt.Printnl() on string (segmentation violation)

2016-08-25 Thread arboooz
Hello everyone, My application occasionally crash when processing string variables. I can not provide you with the full example, but the code looks more or less like this: package main import "fmt" type Event struct { tokenA string tokenB string tokenC string tokenD string } func

[go-nuts] Re: Why a **T value can't call methods of *T and T if a *T value can call methods of T?

2016-08-25 Thread xiiophen
[edit] Just retracting the statement *"if you have pointers to pointers in this context you're probably doing something wrong/unnecessary*." I made earlier - which is clearly wrong on a moments thought. Sorry.. -- You received this message because you are subscribed to the Google Groups

[go-nuts] Re: Why a **T value can't call methods of *T and T if a *T value can call methods of T?

2016-08-25 Thread xiiophen
I get the original points. Though the current behaviour is in my opinion consistent with https://golang.org/ref/spec#Method_declarations "[Receiver] must be of the form T or *T (possibly using parentheses) where T is a type name" and https://golang.org/ref/spec#Method_sets I can see the case

[go-nuts] Re: Allocating memory to consume a variable from channel in select statement

2016-08-25 Thread T L
On Wednesday, August 24, 2016 at 9:44:04 PM UTC+8, Chintan Sheth wrote: > > I am using select statement to dispatch work coming from multiple > goroutines, the variables used to consume the channel are allocated > manually as I am recycling those > > > for { > a := getA() > b := getB() >

[go-nuts] Re: Why a **T value can't call methods of *T and T if a *T value can call methods of T?

2016-08-25 Thread T L
On Thursday, August 25, 2016 at 5:41:32 AM UTC+8, xiio...@gmail.com wrote: > > It doesn't/wouldn't seem to be any technical issue implementing methods on > any depth of pointer type .. as demonstrated in the unsafe example linked > from a previous related discussion (ie >

[go-nuts] Re: Why a **T value can't call methods of *T and T if a *T value can call methods of T?

2016-08-25 Thread T L
On Thursday, August 25, 2016 at 5:41:32 AM UTC+8, xiio...@gmail.com wrote: > > It doesn't/wouldn't seem to be any technical issue implementing methods on > any depth of pointer type .. as demonstrated in the unsafe example linked > from a previous related discussion (ie >

Re: [go-nuts] In the future, how to keep runtime.KeepAlive from dead code elimination?

2016-08-25 Thread Dave Cheney
Not really. Runtime.KeepAlive is special, it'll continue to be special in the future. -- 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

Re: [go-nuts] In the future, how to keep runtime.KeepAlive from dead code elimination?

2016-08-25 Thread Cholerae Hu
Does that mean that only inlined functions will be optimized and any functions not inlined will not be optimized ? 在 2016年8月25日星期四 UTC+8上午11:55:12,Ian Lance Taylor写道: > > On Wed, Aug 24, 2016 at 7:06 PM, Cholerae Hu > wrote: > > > > I've read the source of package

[go-nuts] Re: Search for Another JSON Package

2016-08-25 Thread dc0d
Thanks; the problem is I'm using a third party package with lots of data-structures and those data is going into CouchDB and deserializing would set the IEEE 754 hell loose. Also the `IntegerAsString` on `codec.JsonHandle` in ugorji package does not works - created an issue for that. I ended

[go-nuts] gomobile. Not able to build IOS apps.

2016-08-25 Thread Joe Blue
hey everyone, The problem is that i cant build a simple gomobile app for IOS. I can build a normal (swift) IOS project in the Simulator & IPhone. I can build the golang app for Android. The public git repo of the Test Harness project is here: https://bitbucket.org/gedw99/md-mobile-x Its

Re: [go-nuts] ListenAndServe without alert

2016-08-25 Thread Joe Blue
Got it. thanks On Thu, Aug 25, 2016 at 5:03 AM Matt Harden wrote: > I don't think signing has anything to do with Go itself. You sign the > binary executable file that your tool generates, regardless of the language > it was written in. > > On Wed, Aug 24, 2016 at 2:16