[go-nuts] Re: Go package management proposal process

2016-09-06 Thread Lucio
Probably too obvious a suggestion to be taken seriously, but just in case no one else has thought of this, would a "go vendor" command be useful as the main objective here? Lucio. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe

[go-nuts] Re: src/log/log.go: What makes it expensive in this code of log.go?

2016-09-06 Thread Dave Cheney
The log package has some benchmarks, maybe make the change and see if it makes a difference. On Wednesday, 7 September 2016 02:46:09 UTC+10, mwor...@gmail.com wrote: > > Hey, It's commented "release lock while getting caller info - it's > expensive" in source code of /src/log/log.go line:150. >

[go-nuts] Re: src/log/log.go: What makes it expensive in this code of log.go?

2016-09-06 Thread mworks092
Yes I closed the issue on github. How about discuss about it here 在 2016年9月7日星期三 UTC+8上午5:33:50,Benjamin Measures写道: > > Link to the discussion moved from github: issue #17003 > > -- You received this message because you are subscribed to the Google G

[go-nuts] Re: What 'select' is doing here?

2016-09-06 Thread Pablo Rozas-Larraondo
Right! Ok, I understand it now, there's no concurrent evaluation happening. And I understand what you meant when evaluating the functions before the select statement in your code. Thank you very much for your help in understanding this Dave. Pablo On Wednesday, September 7, 2016 at 11:51:59 A

[go-nuts] Re: What 'select' is doing here?

2016-09-06 Thread Dave Cheney
The best description i've found comes from the spec, see the "execution of select statement" section. https://golang.org/ref/spec#Select_statements The program I rewrote for you is identical to the one you wrote, all the work to evaluate the RHS of the select cases happens "before" the select

[go-nuts] Re: What 'select' is doing here?

2016-09-06 Thread Pablo Rozas-Larraondo
Thanks Dave. It seems though that whatever select chooses to run (A or B) the program takes 1000 ms to complete. I would expect the program to finish in 100 ms if A is chosen or 1000 ms in the case of B. I wonder if both functions are evaluated concurrently no matter which case select chooses.

Re: [go-nuts] interactive debugger for go ??

2016-09-06 Thread Tim Hawkins
If you install the go plugin on intelij (community or paid) and install the delve debugger, you get a full go ide with interactive visual debugging for go. On 7 Sep 2016 00:44, "Bruno Albuquerque" wrote: > https://github.com/derekparker/delve > > Em ter, 6 de set de 2016 às 13:42, JM escreveu:

Re: [go-nuts] help with bazil.org/fuse

2016-09-06 Thread Dan Kortschak
On Wed, 2016-09-07 at 09:05 +0930, Dan Kortschak wrote: > > These are just the flags passed to open. If you want to act on the > > truncate flag, do it once within open, not on every single > subsequent > > call to write. > > > That makes sense. So, we're narrowing down on my field of ignorance. >

Re: [go-nuts] help with bazil.org/fuse

2016-09-06 Thread Dan Kortschak
On Tue, 2016-09-06 at 19:54 +0200, Lars Seipel wrote: > These are just the flags passed to open. If you want to act on the > truncate flag, do it once within open, not on every single subsequent > call to write. > That makes sense. So, we're narrowing down on my field of ignorance. Am I right in

Re: [go-nuts] Re: help with bazil.org/fuse

2016-09-06 Thread Dan Kortschak
On Tue, 2016-09-06 at 13:19 -0700, Tommi Virtanen wrote: > Err sorry should have read more. Your panic message was > > 2016/09/05 02:57:52 fuse: panic in handler for Write [ID=0x25 > Node=0x8 > Uid=1000 Gid=1000 Pid=3299] 0x2 17 @31 fl=0 lock=0 ffl=OpenReadWrite: > runtime error: slice bounds ou

[go-nuts] What 'select' is doing here?

2016-09-06 Thread Dave Cheney
Here's the same program rewritten. https://play.golang.org/p/ANHNUcPjR2 If ch is writable, then select pseudo randomly chooses the first or second case. The default case is never taken unless ch is blocked, in which case the goroutine will block sending to ch indefinitely. -- You received th

[go-nuts] What 'select' is doing here?

2016-09-06 Thread Pablo Rozas Larraondo
I'm trying to understand how the 'select' statement works internally. The execution process of select as described in https://golang.org/ref/spec#Select_statements says on number 2: "If one or more of the communications can proceed, a single one that can proceed is chosen via a uniform pseudo-rando

[go-nuts] Re: src/log/log.go: What makes it expensive in this code of log.go?

2016-09-06 Thread Benjamin Measures
Link to the discussion moved from github: issue #17003 -- 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+un

Re: [go-nuts] Go string to uintptr

2016-09-06 Thread Andy Balholm
If you use cgo, there is a helper function C.CString to do this. You can convert the string to a []byte, append 0 (for a null-terminated string), and take the address of the first byte. Andy -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To u

[go-nuts] Go string to uintptr

2016-09-06 Thread Luke Mauldin
I am on Windows and I am using the syscall package to call C functions exposed in windows dlls. I am trying to call a C function that accepts a "const char*" parameter. How do I convert a Go string to a uintptr that I can use in (p *LazyProc) Call(...)? I have tried several different approac

[go-nuts] Re: help with bazil.org/fuse

2016-09-06 Thread Tommi Virtanen
Err sorry should have read more. Your panic message was 2016/09/05 02:57:52 fuse: panic in handler for Write [ID=0x25 Node=0x8 Uid=1000 Gid=1000 Pid=3299] 0x2 17 @31 fl=0 lock=0 ffl=OpenReadWrite: runtime error: slice bounds out of range so it's the slice that's busted, not the deref. On Tues

Re: [go-nuts] Re: job queue with the ability to kill worker processes

2016-09-06 Thread Edward Muller
There is also: https://github.com/bgentry/que-go On Tue, Sep 6, 2016 at 12:56 PM Tieson Molly wrote: > Thanks Jason, I was looking for something to handle external processes. > > > > On Monday, September 5, 2016 at 11:13:59 AM UTC-4, Jason E. Aten wrote: >> >> On Thursday, September 1, 2016 at

[go-nuts] Re: help with bazil.org/fuse

2016-09-06 Thread Tommi Virtanen
On Sunday, September 4, 2016 at 8:18:08 PM UTC-7, kortschak wrote: > Can someone tell me what it is that I'm failing to understand with file > truncation/write and FUSE? > Doesn't seem to have much to do with FUSE. goroutine 50 [running]: > bazil.org/fuse/fs.(*Server).serve.func2(0x65e4a0, 0x

[go-nuts] Re: job queue with the ability to kill worker processes

2016-09-06 Thread Tieson Molly
Thanks Jason, I was looking for something to handle external processes. On Monday, September 5, 2016 at 11:13:59 AM UTC-4, Jason E. Aten wrote: > > On Thursday, September 1, 2016 at 4:40:50 AM UTC-7, Tieson Molly wrote: >> >> Are there any go projects that implement a queue where workers that

Re: [go-nuts] help with bazil.org/fuse

2016-09-06 Thread Lars Seipel
On Mon, Sep 05, 2016 at 12:47:51PM +0930, Dan Kortschak wrote: > func (f *RW) Write(ctx context.Context, req *fuse.WriteRequest, resp > *fuse.WriteResponse) error { > f.mu.Lock() > defer f.mu.Unlock() > > f.mtime = f.fs.now() > > var err error > if req.FileFlags&fus

Re: [go-nuts] Negative (BC) dates.

2016-09-06 Thread Bruno Albuquerque
Ah, yes... That makes sense. But no, I do not need to represent dates billion years in the past. I was just testing if things would work by using the limits. I would only need to have dates down to around a few centuries BC. Em ter, 6 de set de 2016 às 14:30, Jakob Borg escreveu: > Year() retu

Re: [go-nuts] Negative (BC) dates.

2016-09-06 Thread Jakob Borg
Year() returns an int, and the playground is 32 bit, so can't represent something smaller than about minus two billion. However if your use case is to represent times billions of years in the past I don't think a time.Time is the right type. There's the whole business about time zones, leap years a

Re: [go-nuts] interactive debugger for go ??

2016-09-06 Thread Bruno Albuquerque
https://github.com/derekparker/delve Em ter, 6 de set de 2016 às 13:42, JM escreveu: > Will there be a debugger that will allow me to step into my code, watch > the flow, and go line by line in real time, see values set, etc..? does > this already exist and i'm just not aware of it? I'

[go-nuts] sector - Dependency Injection for Go

2016-09-06 Thread dc0d
This is a Dependency Injection package for Go. Point of interest here (for me) was separating the creation concern from injection concern. Creating objects is done using factories and injecting values into struct fields is done using the injector - which can go

Re: [go-nuts] interactive debugger for go ??

2016-09-06 Thread Sam Whited
On Tue, Sep 6, 2016 at 11:42 AM, JM wrote: > Will there be a debugger that will allow me to step into my code, watch the > flow, and go line by line in real time, see values set, etc..? does this > already exist and i'm just not aware of it? I'm not a full time go dev > right now, but use

[go-nuts] Re: [golang-dev] help me with gorutines

2016-09-06 Thread airborne . spatula
Hello, You almost had it, just backwards. In this play, the goroutines are waiting for permission to print their next value, printing it, then passing the permission to the other goroutine. https://play.golang.org/p/LsxOfKihM7 I think that meets your //redact requirements too. Have fun. On Tues

Re: [go-nuts] Re: Broadcasting via channel

2016-09-06 Thread Chris Holland
One more thing, if you want the wait condition to be grouped in a select{} use the .Channel() method to get the channel. The Wait helper method does this with a timeout, as an example. After the signal the channel is dead so you have to use Channel() again to get the new one. If you're using it

[go-nuts] src/log/log.go: What makes it expensive in this code of log.go?

2016-09-06 Thread mworks092
Hey, It's commented "release lock while getting caller info - it's expensive" in source code of /src/log/log.go line:150. I'm confused with what makes it expensive if we didn't unlock the l.mu ? Does goroutines have context ? func (l *Logger) Output(calldepth int, s string) error { now :=

[go-nuts] Re: Logging Facade

2016-09-06 Thread yun . zhi . lin
I was looking around for the same thing and found this: https://github.com/ventu-io/slf I agree with Ian, for simple logs, a interface will suffice. But for structured logs with Fields it gets a bit more complicated. On Sunday, February 1, 2015 at 5:01:13 AM UTC+11, Jérôme LAFORGE wrote: > > He

Re: [go-nuts] Re: In case you missed it: language benchmarks for Go 1.7, and language adoption

2016-09-06 Thread sascha.l.teichmann via golang-nuts
Am Montag, 5. September 2016 15:41:28 UTC+2 schrieb Jason E. Aten: > > > On Wednesday, August 31, 2016 at 8:44:57 AM UTC-7, Eric Johnson wrote: >> >> >> On 8/31/16 2:04 AM, Harald Weidner wrote: >> > The Java counterpart of this benchmark does not use the Java build-in >> > maps, but imports a

[go-nuts] Curiosity in encoding/json mem allocations

2016-09-06 Thread Tonny Staunsbrink
Hi I hope this is the right forum for posting this kind of question: Debugging application performance, I came across JSON stream parsing causing a large number of mem allocations. Here's a snippet of code, which exemplifies my findings: var ( noSpace= `{"Key":"StringValue"}` oneSpace =

[go-nuts] How to build mock class?

2016-09-06 Thread Klaus Ma
Hi team, I'm trying to write some mock class for unit test. And in the mock class, only part of function are changed. Is there any way to do so? For example, in the follow code slice, I'd like to print FakeMyClass.Object's return value. package main import ( "fmt" ) type MyClass struct {

[go-nuts] interactive debugger for go ??

2016-09-06 Thread JM
Will there be a debugger that will allow me to step into my code, watch the flow, and go line by line in real time, see values set, etc..? does this already exist and i'm just not aware of it? I'm not a full time go dev right now, but use it part time so I may just not know about this

[go-nuts] Negative (BC) dates.

2016-09-06 Thread Bruno Albuquerque
I was trying to store BC dates in a database and due to various issues with date handling and assumptions about date ranges, I decided to store the date as a int64 number and use time.Unix() to convert it to a time object. This mostly works but I found some weird behavior: https://play.golang.org/

Re: [go-nuts] Re: Broadcasting via channel

2016-09-06 Thread Chris Holland
I needed something similar to ManualResetEvent in C# here is what I'm using atm. https://play.golang.org/p/UUyyK8ifku This is attempting to be an edit, this example works better. Also there is a helper method on the struct if don't want to wait forever Wait has a timeout option. Although there

Re: [go-nuts] Re: In case you missed it: language benchmarks for Go 1.7, and language adoption

2016-09-06 Thread 'Isaac Gouy' via golang-nuts
On Wednesday, August 31, 2016 at 4:47:35 PM UTC-7, Tim Hawkins wrote: > > I would have expected that aside from informing about general performance, > one of the purposes for benchmarks would have been to create pressure for > improvement of key features of the laguage, this seems to circumvent

Re: [go-nuts] Re: Broadcasting via channel

2016-09-06 Thread Chris Holland
I've needed something similar. Its like a ManualResetEvent in C#, here is some test code and the struct I use: https://play.golang.org/p/mvSMwMZX51 Note running that on playground will timeout due to everything being asleep, but this gets the idea across. On Sunday, September 4, 2016 at 4:29:1

[go-nuts] crypto/sha1.blockAMD64 taking more CPU on FreeBSD

2016-09-06 Thread Niloy Debnath
Hi, I am running a golang Webserver on Linux and FreeBSD. I have generated certificates using SHA1 algo but I have observed different result while doing CPU profiling on both the machines. Linux is fine but on FreeBSD blockAMD64 is the second highest CPU consumer after syscall.Syscall. It loo

[go-nuts] Re: Help me, i don't understand why

2016-09-06 Thread Ринат Галиев
Yes, thank you, but i have decided it)) -- 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 https://

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-06 Thread aiden0xz
Whatever, thanks so much. 在 2016年9月6日星期二 UTC+8下午5:54:34,Dave Cheney写道: > > I'm sorry. I cannot help you, I'm probably wrong about the goroutines > holding on to webaockets. Perhaps one of the libraries you use has a memory > leak bug. -- You received this message because you are subscribed t

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-06 Thread Dave Cheney
I'm sorry. I cannot help you, I'm probably wrong about the goroutines holding on to webaockets. Perhaps one of the libraries you use has a memory leak bug. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-06 Thread aiden0xz
When user refresh the page, the old websocket conn will be closed and a new one created. I do not understand "If the websocket never disconnects, then the goroutine will pin all memory it is using." The websocekt conn block on read, why will pin all memory? 在 2016年9月6日星期二 UTC+8下午5:22:39,Da

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-06 Thread Dave Cheney
You have 4601 goroutines blocked on reading from the websocket goroutine profile: total 4583 1526 @ 0x42d77a 0x42806b 0x4277c9 0x67ffb8 0x680024 0x681861 0x6924e0 0x5b2e5c 0x5b34bc 0x7bc06d 0x7bc1b6 0x7bd237 0x7a2d94 0x45da11 # 0x4277c8net.runtime_pollWait+0x58

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-06 Thread aiden0xz
I can make sure that the goroutine is exited, because the goroutine count is stable but the heap count is always increase. You can see more detail pprof from https://comet.shiyanlou.com/debug/pprof/. 在 2016年9月6日星期二 UTC+8下午5:05:05,Dave Cheney写道: > > Are you sure that goroutines are exiting? You

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-06 Thread Dave Cheney
Are you sure that goroutines are exiting? You can check this in the /debug/pprof handler. It will tell you how many goroutines are currently running. On Tuesday, 6 September 2016 18:49:29 UTC+10, aide...@gmail.com wrote: > > I think > https://gist.github.com/aiden0z/b8cf00953e81f778bd584fa2ff7e

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-06 Thread aiden0xz
I think https://gist.github.com/aiden0z/b8cf00953e81f778bd584fa2ff7eaae7#file-server-go-L268 error is not the core problem. The error is ignored because the go-socket.io no error returned, see https://github.com/googollee/go-socket.io/blob/master/server.go#L91. go 1.6 and 1.7 I have tried,

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-06 Thread Dave Cheney
This error handling looks wrong, https://gist.github.com/aiden0z/b8cf00953e81f778bd584fa2ff7eaae7#file-server-go-L268 Any error from socketio is ignored, and the method always succeeds unconditionally. Also, which version of Go are you using ? On Tuesday, 6 September 2016 18:07:42 UTC+10, aide

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-06 Thread aiden0xz
I have restart the the websocket service, and collect new callgraph. 1. in-use heap callgraph 2. heap alloc callgraph

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-06 Thread Dave Cheney
Also, heap released will not grow until you stop the memory leak and enough of the heap remains idle for more than 10 minutes. -- 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, sen

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-06 Thread Dave Cheney
Are you sure that goroutines are exiting? You can check this in the /debug/pprof handler. It will tell you how many goroutines are currently running. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop recei

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-06 Thread Dave Cheney
I think your program is leaking memory somewhere else. Is the source of your application avaiable? Can you please share a graph of the -alloc_objects profile -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and sto

[go-nuts] Re: memory leak with websocket service based on go-socket.io

2016-09-06 Thread aiden0xz
I has installed the pprof handler and also opened the gc debug. The HeapSys in /debug/pprof/heap page is aways increase, the HeapReleased aways is 0. The gc debug log show that the scvg# is not release any memory. If the runtime.goexit be called, the goroutine will be return. But why the memo