[go-nuts] Re: DialTLS + Context with http Transport

2017-08-18 Thread Joshua Boelter
Depending on what you're trying to do, this might get you further https://github.com/golang/go/blob/46f4bfb2d17a3ccb4b3207d086a90cac3c00ea2f/src/crypto/tls/common.go#L417 https://github.com/golang/go/issues/16363 On Thursday, August 17, 2017 at 3:33:14 PM UTC-7, Gabriel Rosenhouse wrote: > >

Re: [go-nuts] Re: [ANN] Gop - Build and manage your Go applications out of GOPATH

2017-08-18 Thread Maurizio Vitale
Not everybody wants to accept that all projects have to live under a unique GOPATH. For instance I want to be able to clone a project and build it wherever I want. I might even want to have more than one sandbox with the same project. Or golang projects that are deep inside another project tree.

Re: [go-nuts] signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x7fcb5ae54390

2017-08-18 Thread Ian Lance Taylor
On Fri, Aug 18, 2017 at 5:36 PM, Justin Israel wrote: > > I have cgo code that looks like this in a few of my own libs and I just > started seeing crashes like this as of Go 1.8. Could it be related to the > need for using runtime.KeepAlive? I have been adding that to my

Re: [go-nuts] signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x7fcb5ae54390

2017-08-18 Thread Justin Israel
On Sat, Aug 19, 2017, 8:38 AM Ian Lance Taylor wrote: > On Fri, Aug 18, 2017 at 8:59 AM, Bhaskar Singhal > wrote: > > > > C function just copies the parameters passed. All of the params have > escaped > > to heap as seen in output generated by using

RE: [go-nuts] Go channels overused and hyped?

2017-08-18 Thread John Souvestre
Interesting. So you think it is a general safety advisory (which would apply to any language) to use synchronization (ex: mutex or channel) and not a more focused push to use channels? Hmmm... I didn't understand it that way. I thought that "communicate" was a reference to the "C" in CSP.

Re: [go-nuts] Re: Is this bad concurrency?

2017-08-18 Thread Josh Humphries
There's not a way to terminate a goroutine. But you can create a context with cancellation. Each goroutine would need to periodically check context.Err() and exit on its own. When you exit, you cancel the context. You could combine this with a WaitGroup in order to not exit until all other

[go-nuts] Re: Is this bad concurrency?

2017-08-18 Thread bill . warner
Thanks to both for replying. Both pieces of advice cover the use case of waiting for all goroutines to complete before exiting. I have the opposite problem. I want to end all goroutines if I exit. Is there anything in the sync package for that? On Friday, August 18, 2017 at 2:40:39 PM UTC-4,

Re: [go-nuts] multiply and divide

2017-08-18 Thread Michael Jones
Integer is a different matter because of truncation. The order is significant. Floating point is tricky there. the fractional parts can be multiplied in any order in terms of precision. however, the exponents add so best of all would be a kind of alternating summation that keeps them in the +/-

Re: [go-nuts] signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x7fcb5ae54390

2017-08-18 Thread Ian Lance Taylor
On Fri, Aug 18, 2017 at 8:59 AM, Bhaskar Singhal wrote: > > C function just copies the parameters passed. All of the params have escaped > to heap as seen in output generated by using -gcflags "-m -m" during build. > > I am trying to figure out if there is a possibility

Re: [go-nuts] Go channels overused and hyped?

2017-08-18 Thread Ian Lance Taylor
On Fri, Aug 18, 2017 at 12:02 PM, John Souvestre wrote: > > I think that both of the suggestions below are great. But I’m left > wondering about the Go mantra > > > > Do not communicate by sharing memory. Instead, share memory by > communicating. > > > > What does it say?

[go-nuts] Re: transport: http2Server.HandleStreams failed to read frame: read tcp 192.168.56.1:8080->192.168.56.1:29065: wsarecv: An existing connection was forcibly closed by the remote host.

2017-08-18 Thread rashit . khamidullin
Hello Nikhli, have you solved the issue? вторник, 17 января 2017 г., 6:36:13 UTC+3 пользователь Nikhil Tathe написал: > > Hi all, > I am building a grpc server client communication on windows. > I am getting error as > transport: http2Server.HandleStreams failed to read frame: read tcp >

RE: [go-nuts] Go channels overused and hyped?

2017-08-18 Thread John Souvestre
P.S. And if you want to reduce it to a one-liner, how about this? Communicating is better than sharing sometimes, and vice versa. John John Souvestre - New Orleans LA From: John Souvestre [mailto:j...@souvestre.com] Sent: 2017 August 18, Fri 14:03 To: 'golang-nuts'

RE: [go-nuts] multiply and divide

2017-08-18 Thread John Souvestre
Ø "multiply first, then divide." While often the right method, I don’t think that it always is. Consider: -Integer: It is as long as the product doesn’t overflow (before the divide). -Floating: I’m inclined to think that combining numbers of the same magnitude first might be a

RE: [go-nuts] Is this bad concurrency?

2017-08-18 Thread John Souvestre
You might want to consider using a sync.WaitGroup. It’s for such situations. John John Souvestre - New Orleans LA From: golang-nuts@googlegroups.com [mailto:golang-nuts@googlegroups.com] On Behalf Of bill.war...@talentinc.com Sent: 2017 August 18, Fri 13:01 To: golang-nuts Subject:

[go-nuts] Is this bad concurrency?

2017-08-18 Thread bill . warner
Hi, https://play.golang.org/p/lR6_mxSjtb I have two long running things to do, I'd like to do them in parallel, then sync up at the end. I've written it as a function which gets one thing done, and which backgrounds the second thing with a goroutine. Thing one has a lot of reasons to exit

Re: [go-nuts] Re: Getting some strange benchmark results

2017-08-18 Thread Agniva De Sarker
Thanks On Aug 18, 2017 1:42 PM, wrote: > From the recent GopherCon, golang's profiler has a tool for inspecting > allocations that might solve your problem. > > https://youtu.be/2557w0qsDV0?list=PLq2Nv-Sh8EbZEjZdPLaQt1qh_ohZFMDj8=526 > > -- > You received this message

[go-nuts] multiply and divide

2017-08-18 Thread Michael Jones
Here is a minor musing from something that came up yesterday. Sometimes we see a real number expression as simple as... x*y/z ...and knowing from basic algebra that... (x*y)/z == x*(y/z) ...we might not expect much difference between the two in our code. Alas, computer floating point does

Re: [go-nuts] Segmentation fault when linking with Go library from a C++ program

2017-08-18 Thread inetic
I think I found it, I was wrong above where I said that at first I did not have address sanitizer enabled. Seems when I disable it, I no longer see any "Segmentation fault" messages nor memory leak reports from the sanitizer (obviously). That is a problem. When you say that gdb doesn't show

Re: [go-nuts] signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x7fcb5ae54390

2017-08-18 Thread Bhaskar Singhal
C function just copies the parameters passed. All of the params have escaped to heap as seen in output generated by using -gcflags "-m -m" during build. I am trying to figure out if there is a possibility that gc frees any of these parameters before the C function call returns. On Fri, Aug 18,

[go-nuts] nginx and upstream prematurely closed connection while reading upstream

2017-08-18 Thread wilk
Hi, I'm experiencing a lot of log in nginx : upstream prematurely closed connection while reading upstream Looking in my code it's because I added w.Header().Set("content-length", strconv.Itoa(len(w.Body.Bytes( If i remove it, no more logs and my clients are happy again I use an

Re: [go-nuts] signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x7fcb5ae54390

2017-08-18 Thread Ian Lance Taylor
On Fri, Aug 18, 2017 at 12:53 AM, Bhaskar Singhal wrote: > I am running into a seg fault. The code keeps crashing either due to > unexpected signal or double free. > > Any pointers on what I am doing wrong here: > > Code Snippet: > // Put puts the given key / value to

Re: [go-nuts] Go channels overused and hyped?

2017-08-18 Thread Michael Jones
yes... everything is good for what it is designed for and less-good for what it is not designed for. mutex-protected counters are good channels for data communication are good neither is a perfect stand in for the other. nothin wrong with channels. On Fri, Aug 18, 2017 at 4:38 AM, Tamás Gulácsi

Re: [go-nuts] Segmentation fault when linking with Go library from a C++ program

2017-08-18 Thread Konstantin Khomoutov
On Fri, Aug 18, 2017 at 04:21:27AM -0700, ine...@gmail.com wrote: > I have a C++ application from which I need to call Go functions. I noticed > that the application crashes > on exit from the `main` function (with only a "Segmentation fault" message, > no core dump Not to answer your question,

Re: [go-nuts] Segmentation fault when linking with Go library from a C++ program

2017-08-18 Thread Ian Lance Taylor
On Fri, Aug 18, 2017 at 4:21 AM, wrote: > > I have a C++ application from which I need to call Go functions. I noticed > that the application crashes > on exit from the `main` function (with only a "Segmentation fault" message, > no core dump and neither > did gdb show anything

[go-nuts] Segmentation fault when linking with Go library from a C++ program

2017-08-18 Thread inetic
I have a C++ application from which I need to call Go functions. I noticed that the application crashes on exit from the `main` function (with only a "Segmentation fault" message, no core dump and neither did gdb show anything useful) about once in three runs. Then I added the

[go-nuts] Re: FAIL: TestBuildmodePIE

2017-08-18 Thread Marvin Stenger
This is https://github.com/golang/go/issues/21452 Am Freitag, 18. August 2017 13:31:16 UTC+2 schrieb SauliusGurklys: > > Hi, > > I'm using > > $ uname -a > Linux alio 4.11.12-1-MANJARO #1 SMP PREEMPT Fri Jul 21 08:51:46 UTC 2017 > x86_64 GNU/Linux > > For a couple of days my go build from

Re: [go-nuts] Go channels overused and hyped?

2017-08-18 Thread Tamás Gulácsi
No. Use channels to coordinate and send data between goroutines, and other sync primitives to coordinate access to shared resources. Both has its pros and cons, use the best tool for the job. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] FAIL: TestBuildmodePIE

2017-08-18 Thread SauliusGurklys
Hi, I'm using $ uname -a Linux alio 4.11.12-1-MANJARO #1 SMP PREEMPT Fri Jul 21 08:51:46 UTC 2017 x86_64 GNU/Linux For a couple of days my go build from source started to fail on test "TestBuildmodePIE" ... ok cmd/doc 0.027s ok cmd/fix 0.045s --- FAIL: TestBuildmodePIE (1.27s)

Re: [go-nuts] Domain-driven design and go

2017-08-18 Thread juicemia
You're right. A lot of it is stuff you pick up as you grow your skills. I wrote the article to show how the Go community has standardized on patterns that were talked about in the book. I guess I could have done a better job of accentuating that. I think a great example of that is the

Re: [go-nuts] Domain-driven design and go

2017-08-18 Thread Konstantin Khomoutov
On Fri, Aug 18, 2017 at 03:29:01AM -0700, Hugo Torres wrote: > Recently I've been reading "Domain Driven Design" and I think it has some > useful stuff about organizing Go programs. > > I wrote some of my thoughts up on my blog here > . > > Would love to

[go-nuts] Re: [ANN] Gop - Build and manage your Go applications out of GOPATH

2017-08-18 Thread Fino
Hello, Can I ask for a typical use case? BR fino -- 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,

Re: [go-nuts] How do you debug Go itself on VM env or Docker container?

2017-08-18 Thread Konstantin Khomoutov
On Fri, Aug 18, 2017 at 12:26:02AM -0700, 高橋誠二 wrote: > I'm trying to debug and run `./all.bash` with VM or docker, but they don't > work for several reasons. > > On VM, I added box of CentOS and Ubuntu, though, they cancels ./all.bash at > `hardlink` testing. The "VM" is too vague a term

[go-nuts] Domain-driven design and go

2017-08-18 Thread Hugo Torres
Hi everybody, Recently I've been reading "Domain Driven Design" and I think it has some useful stuff about organizing Go programs. I wrote some of my thoughts up on my blog here . Would love to know what everybody thinks. Thanks, Hugo -- You received

[go-nuts] Re: How do you debug Go itself on VM env or Docker container?

2017-08-18 Thread 高橋誠二
Do you know any setting file like Vagrantfile or Dockerfile, which is appropriate for this case? 2017年8月18日金曜日 17時50分30秒 UTC+9 Tamás Gulácsi: > > Fix your VM? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

[go-nuts] How do you debug Go itself on VM env or Docker container?

2017-08-18 Thread Tamás Gulácsi
Fix your VM? -- 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

Re: [go-nuts] Go channels overused and hyped?

2017-08-18 Thread snmed
Hi Michael Thank you very much for your very informative and elaborating post. I never had seen that blog this way, but your post has opened my eyes and now is clear that one should not compare apples with pears. So the tradeoff is, use concurrency in a safe manner or squezze the last drop

Re: [go-nuts] The memory release about Turning C arrays into Go slices

2017-08-18 Thread Konstantin Khomoutov
On Fri, Aug 18, 2017 at 10:39:29AM +0300, Konstantin Khomoutov wrote: [...] > There can't be easy answer to a question like this in C. > Consider: > > // This function clearly transfers the ownership of the memory > // it returns to the caller. > int* allocate(int n) > { > int *mem =

[go-nuts] Re: Getting some strange benchmark results

2017-08-18 Thread kpratt
>From the recent GopherCon, golang's profiler has a tool for inspecting allocations that might solve your problem. https://youtu.be/2557w0qsDV0?list=PLq2Nv-Sh8EbZEjZdPLaQt1qh_ohZFMDj8=526 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Compile-time Instrumentation

2017-08-18 Thread kpratt
Is there any way in go to do this? Ideally I'd like to be able to do something like pass the compiler an AST -> AST function to be run between front and back end compile steps. The best way I see atm is to do a precompile job that dumps the AST back out to a different directory and compiles

[go-nuts] signal SIGSEGV: segmentation violation code=0x80 addr=0x0 pc=0x7fcb5ae54390

2017-08-18 Thread Bhaskar Singhal
I am running into a seg fault. The code keeps crashing either due to unexpected signal or double free. Any pointers on what I am doing wrong here: Code Snippet: // Put puts the given key / value to the kvstore func (kvs *kvstore) Put(key []byte, value []byte) error { /* Encode key to

Re: [go-nuts] The memory release about Turning C arrays into Go slices

2017-08-18 Thread Konstantin Khomoutov
On Thu, Aug 17, 2017 at 06:50:42PM -0700, jianzhang...@gmail.com wrote: > > > As the instruction > > > of https://github.com/golang/go/wiki/cgo#turning-c-arrays-into-go-slices > > > shows, the GC of Go will not release it. > > > An example as the following, but I have a question about when and

Re: [go-nuts] Calling Julia from Go

2017-08-18 Thread Konstantin Khomoutov
On Wed, Aug 16, 2017 at 11:57:51PM -0700, mrech...@gmail.com wrote: > I would like to implement a valuation server. For the whole server > infrastructure I would like to use Go, because it feels more natural than > any other language for it. For the implementation of the valuations I would >

[go-nuts] How do you debug Go itself on VM env or Docker container?

2017-08-18 Thread 高橋誠二
I'm trying to debug and run `./all.bash` with VM or docker, but they don't work for several reasons. On VM, I added box of CentOS and Ubuntu, though, they cancels ./all.bash at `hardlink` testing. And on docker, it also fails cuz of the permission of host directory, which includes `src`, so