[go-nuts] Re: blocks when trying to reset a timer

2016-12-12 Thread sleepy
seems I know what is wrong: my timer is not an *active* one. 在 2016年12月13日星期二 UTC+8下午3:09:30,sleepy写道: > > from the documentation of *func (*Timer) Reset > * > >> >> To reuse an active timer, always call its Stop method first and—if it had >> expired—dra

[go-nuts] blocks when trying to reset a timer

2016-12-12 Thread sleepy
from the documentation of *func (*Timer) Reset * > > To reuse an active timer, always call its Stop method first and—if it had > expired—drain the value from its channel. For example: > if !t.Stop() { > <-t.C > } > t.Reset(d) > but my code blocks at th

[go-nuts] Re: Function scoped method receivers

2016-12-12 Thread go-question
Thanks again. On Monday, December 12, 2016 at 7:13:28 PM UTC-8, Dave Cheney wrote: > > It's unlikely to be added. > > On Tuesday, 13 December 2016 14:09:52 UTC+11, go-question wrote: >> >> Thanks for confirming. Would you know if its a valid feature on the >> roadmap? >> >> >> >> On Monday, Dece

[go-nuts] Re: Looking for Golang counterpart to 'params' in Python

2016-12-12 Thread paraiso . marc
> > response = requests.request("GET", url, data=payload, headers=headers, > *params=params*) if auth is a header then set the appropriate header : https://golang.org/pkg/net/http/#Header.Set if it is basic auth you need to implement then look at the spec : https://en.wikipedia.org/wiki/Ba

[go-nuts] Re: Idiomatic way of handling http requests in separate goroutines

2016-12-12 Thread Pablo Rozas-Larraondo
In case someone arrives here with the same question I'm going to post a simple example that does what Tamás suggested a few days ago. Use context to block on .Done() and pass the responseWriter as a context Value. Please comment if passing the responseWriter as a context value is not considered

[go-nuts] Looking for Golang counterpart to 'params' in Python

2016-12-12 Thread betsyl via golang-nuts
Hi, In Python, I can include params like this: = *params = {'auth': ''}* response = requests.request("GET", url, data=payload, headers=headers, *params=params*) = Any pointers on how Golang does this? Thanks, Betsy -- You received this messa

Re: [go-nuts] Re: How to copy a struct which contains a mutex?

2016-12-12 Thread Ian Lance Taylor
On Mon, Dec 12, 2016 at 6:11 PM, wrote: > Consider this case: > > package main > > import ( > "errors" > "fmt" > "sync" > ) > > type A struct { > Lock sync.Mutex > Xint > } > > type B struct { > A > Y int > } > > func newA(x int) (A, error) { > if x > 0 { > return A{}, errors.New("x should no

[go-nuts] Re: Function scoped method receivers

2016-12-12 Thread Dave Cheney
It's unlikely to be added. On Tuesday, 13 December 2016 14:09:52 UTC+11, go-question wrote: > > Thanks for confirming. Would you know if its a valid feature on the > roadmap? > > > > On Monday, December 12, 2016 at 5:14:13 PM UTC-8, Dave Cheney wrote: >> >> No, it is not currently possible to do

[go-nuts] Re: Function scoped method receivers

2016-12-12 Thread go-question
Thanks for confirming. Would you know if its a valid feature on the roadmap? On Monday, December 12, 2016 at 5:14:13 PM UTC-8, Dave Cheney wrote: > > No, it is not currently possible to do this, > https://play.golang.org/p/S8w_ztCobQ > > On Tuesday, 13 December 2016 12:08:52 UTC+11, go-question

Re: [go-nuts] Re: How to copy a struct which contains a mutex?

2016-12-12 Thread i
Consider this case: package main import ( "errors" "fmt" "sync" ) type A struct { Lock sync.Mutex Xint } type B struct { A Y int } func newA(x int) (A, error) { if x > 0 { return A{}, errors.New("x should not be positive") } return A{X: x}, nil } func newB(x int, y int) (B, error) { a, er

[go-nuts] Re: Function scoped method receivers

2016-12-12 Thread Dave Cheney
No, it is not currently possible to do this, https://play.golang.org/p/S8w_ztCobQ On Tuesday, 13 December 2016 12:08:52 UTC+11, go-question wrote: > > > I noticed that its possible to define/scope types/interfaces in functions. > > Now I'm not arguing that this is good practice, but for the sake

[go-nuts] Function scoped method receivers

2016-12-12 Thread go-question
I noticed that its possible to define/scope types/interfaces in functions. Now I'm not arguing that this is good practice, but for the sake of curiosity. How can I then add a method w/ a receiver to type foo so that it satisfies interface ifoo? (in function scope) func main() { type

[go-nuts] HeapAlloc / runtime GC behavior absent OS memory pressure

2016-12-12 Thread Levi Corcoran
I'm investigating potential memory leaks in some internal services, currently running Go 1.5.3 (upgrading to 1.7x in our next deployment). I've already tracked down one 3+GB 'leak' in BuckHashSys, which we've worked around with GODEBUG=memprofilerate=0 for now, while we consider rewriting some

[go-nuts] Re: SQLite3 Support without CGo

2016-12-12 Thread brainman
I was toying with this idea myself. Maybe even going all the way with "pure" Go version - with something similar to https://github.com/nkbai/go-memorydll :-) Alex -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group a

Re: [go-nuts] create channels on the fly en-masse

2016-12-12 Thread Ian Lance Taylor
On Mon, Dec 12, 2016 at 2:04 PM, Itay Donanhirsh wrote: > > Is there any penalty for creating channels "on-the-fly" in golang? No, creating a channel just a memory allocation. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

[go-nuts] create channels on the fly en-masse

2016-12-12 Thread Itay Donanhirsh
Hi There, Is there any penalty for creating channels "on-the-fly" in golang? Such a use case: asynchronous processing of data, where every invocation is unrelated to the other. I would imagine something like: ``` ch := make(chan int) func request(i int) chan-> int { reply := make(chan int)

[go-nuts] Re: Go GC time creeping up

2016-12-12 Thread Evan Digby
Hi Dave, Thanks for the insight. I'll look further into the heap creep. I'll also try to get together a log of a run past 8 hours over the next day or so on a machine we're not regularly restarting the go process on to see if it shows anything different. Thanks again, Evan On Monday, 12 Dec

[go-nuts] Re: Go GC time creeping up

2016-12-12 Thread Dave Cheney
Thanks for posting this. Once your application gets to about 1600-1900mb goal the GC pauses seem to stabilise at 3.3+3.2. It looks like the anount of memory in use is creeping up slowly, from around 850 to 950 over the span of the trace. GC sweep time is proportional to the size of the heap, so

[go-nuts] CPU scheduler on Xeon

2016-12-12 Thread Dave Cheney
There are no settings to affect the scheduler save GOMAXPROCS. Check that none of your code or your dependencies are calling runtime.GOMAXPROCS. If that doesn't help, try profiling your application, the cpu or block profile might tell you where your program is hitting a point of contention. --

[go-nuts] What is minimal system requirements to build Go from source?

2016-12-12 Thread Dave Cheney
It's not listed anywhere official but I estimate 512mb per core on 32 bit systems and closer to 768 per core on 64 bit systems. You'll also need some additional memory for the other processes on your system while the build runs. If your virtual machine provider has turned off swap in your vm th

[go-nuts] Go GC time creeping up

2016-12-12 Thread Dave Cheney
Can you try turning on GODEBUG=gctrace=1 and confirming that the pause times are increasing. If you could post the entire output that would be most helpful. Thanks Dave -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

Re: [go-nuts] SQLite3 Support without CGo

2016-12-12 Thread sam
Thanks Konstantin, That was very helpful. I'll do some more looking into it, as taking your suggestion, the ulibc version (here ) seems more simple than glibc. I'm not going to kid myself though, it looks well beyond my cur

[go-nuts] Go GC time creeping up

2016-12-12 Thread Evan Digby
Hi all, Under what circumstances could I expect the Go GC time per pause (right now calculated using PauseTotalNS / NumGC using the runtime stats) creep up slowly over time? Assuming the number of allocations we do per second is consistent, could it be that the GC is somehow not keeping up wit

Re: [go-nuts] Re: How to copy a struct which contains a mutex?

2016-12-12 Thread Ian Lance Taylor
On Sun, Dec 11, 2016 at 11:48 PM, wrote: > > What about type embedding? If put a sync.Mutex in a struct, that struct can > not be embedded into another struct, right? That turns out not to be the case. You can embed that struct in another struct. But then, of course, you can not simply copy th

[go-nuts] What is minimal system requirements to build Go from source?

2016-12-12 Thread mudrinic . mare
I'm trying to build Go on Ubuntu Server with 512 MB RAM but out of luck. It's getting killed by OOM killer everytime I run ./all.bash. ... bootstrap/compile/internal/big bootstrap/compile/internal/ssa bootstrap/internal/gcprog bootstrap/compile/internal/gc go build bootstrap/compile/internal/gc: /

Re: [go-nuts] Is there a tool or a library that lets me typecheck Go programs?

2016-12-12 Thread Jan Mercl
On Mon, Dec 12, 2016 at 6:20 PM wrote: > I realize that obviously the Go compiler does it, I was wondering if there is a good API for that I can use, like the ast package? See https://golang.org/pkg/go/types/ -- -j -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] Re: gRPC golang server and client testing

2016-12-12 Thread Sankar P
I did not find any :( 2016-12-12 1:28 GMT+05:30 : > Would be interested to learn of if you found a good solution. > > > On Saturday, April 23, 2016 at 9:31:19 PM UTC+2, Sankar wrote: >> >> Hi >> >> I have a .proto file which I ran with protoc to generate the _pb.go file. >> I then wrote a server

[go-nuts] Re: Suitable use cases for GroupCache

2016-12-12 Thread davecb . 42
On Thursday, February 20, 2014 at 1:25:46 AM UTC-5, David McCurley wrote: > > OTOH, groupcache has neither cache invalidation (one of the "three" hard >> problems in computer science) nor value updating, which keeps its >> implementation considerably simpler and enables a key feature. AFAICT, thi

Re: [go-nuts] Re: How to copy a struct which contains a mutex?

2016-12-12 Thread i
What about type embedding? If put a sync.Mutex in a struct, that struct can not be embedded into another struct, right? So I guess it's better idea to use structs with pointer to mutex. On Friday, April 8, 2016 at 12:04:05 PM UTC+8, Andrew Gerrand wrote: > > It's fine to put a sync.Mutex in a st

[go-nuts] Re: Go wordfile for UltraEdit

2016-12-12 Thread leeqhui
Thx. Works well. 在 2011年2月15日星期二 UTC+8下午4:11:08,Wei guangjing写道: > > UltraEdit is my favorite Editor on Windows, the syntax wordfile download > at: , enjoy. > > -- > Wei guangjing > > > -- You received this message because you are subscribed to

[go-nuts] Re: gRPC golang server and client testing

2016-12-12 Thread P . Kartner
Would be interested to learn of if you found a good solution. On Saturday, April 23, 2016 at 9:31:19 PM UTC+2, Sankar wrote: > > Hi > > I have a .proto file which I ran with protoc to generate the _pb.go file. > I then wrote a server and a client program that uses the above _pb.go > program. Now

[go-nuts] Importing ECDSA public keys

2016-12-12 Thread benoit . girard0
Hi everyone, I'm trying to import ECDSA public keys such as: > -BEGIN PUBLIC KEY- > MIIBEzCB7AYHKoZIzj0CATCB4AIBATAsBgcqhkjOPQEBAiEA/wEA > AAD///8wRAQg/wEAAAD/ > //wEIFrGNdiqOpPns+u9VXaYhrxlHQawzFOw9jvOPD4n0mBLBEEEaxfR > 8uE

[go-nuts] Is there a tool or a library that lets me typecheck Go programs?

2016-12-12 Thread alehander42
Hey, I realize that obviously the Go compiler does it, I was wondering if there is a good API for that I can use, like the ast package? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails fro

[go-nuts] CPU scheduler on Xeon

2016-12-12 Thread Stannis Kozlov
I have an app with more that 30 threads which takes 4 of 4 cores on my i5 laptop. Meanwhile when I run the app on 2xE2630 I see only 2 processes and 100% utilization of 2 cores. Is it necessary to apply certain settings to let an application with with multicore architecture? -- You received t

[go-nuts] Re: Isn't the use of Context in db/sql non-diomatic?

2016-12-12 Thread Chris Hines
I agree with the sentiment that putting these options in context.Context values is inappropriate. Chris On Friday, December 9, 2016 at 7:14:03 PM UTC-5, Dave Cheney wrote: > > I agree with this. This feels like a case of abusing the "bag of values" > nature of context's Value() feature to smugg

Re: [go-nuts] http.Client interface

2016-12-12 Thread omarshariffdontlikeit
Thats what I think too. Thanks for the confirmation, I'll raise a pull request with the aforementioned third-party package. Thanks everyone. On Monday, December 12, 2016 at 10:25:10 AM UTC, Dave Cheney wrote: > > I don't think it's up to the std lib to define such an interface; that > should be

Re: [go-nuts] SQLite3 Support without CGo

2016-12-12 Thread Konstantin Khomoutov
On Mon, 12 Dec 2016 03:23:21 -0800 (PST) s...@infitialis.com wrote: > Hello, > > I love the pure-Go compiler & tool-chain, especially how effortless > it makes cross-compiling from our Linux development server for our > estate of Windows PCs. > > It even made me feel like it was worth the effort

[go-nuts] SQLite3 Support without CGo

2016-12-12 Thread sam
Hello, I love the pure-Go compiler & tool-chain, especially how effortless it makes cross-compiling from our Linux development server for our estate of Windows PCs. It even made me feel like it was worth the effort to create a DLL wrapper for SQLite3, so we can use it without CGo by bundling t

Re: [go-nuts] http.Client interface

2016-12-12 Thread Dave Cheney
I don't think it's up to the std lib to define such an interface; that should be the responsibility of the third party package -- it should define an interface with the behaviour it requires On Monday, 12 December 2016 20:55:26 UTC+11, omarsharif...@gmail.com wrote: > > Yeah, I thought as much.

Re: [go-nuts] go install seems to do a lot of rebuilding in a container

2016-12-12 Thread shaun
Yes, that was the problem. We were building with CGO_ENABLED=0, which was meaning that built-in packages like "os/user" were always stale and causing rebuilds of almost every other package. Putting this in my dockerfile (along with mounting the pkg directory as a volume shared between each bui

Re: [go-nuts] http.Client interface

2016-12-12 Thread omarshariffdontlikeit
Yeah, I thought as much. I will raise a pull request with the third-party package and implement the requirement of a http.Client as an interface that matches the http.Client methods used by the package. Should the standard library http.Client provide an interface for http.Client so that third-

Re: [go-nuts] CFG for a Go program

2016-12-12 Thread akshanshchahal
Thanks Alan for such informative and prompt reply ! I will work on what you suggested, it seems the right way. On Sunday, December 11, 2016 at 11:53:11 PM UTC+5:30, Alan Donovan wrote: > > On 11 December 2016 at 12:21, > wrote: > >> I am not sure how to get any starting node of type BasicBlock (