[go-nuts] Re: A proposal for generic in go

2016-06-28 Thread Egon
On Wednesday, 29 June 2016 06:35:03 UTC+3, Egon wrote: > > On Wednesday, 29 June 2016 01:51:58 UTC+3, Mandolyte wrote: >> >> Earlier someone asked about real world examples. The obvious standard >> library was mentioned. It only took me a few seconds to remember Jan >> Mercl's interval package. A

[go-nuts] Re: A proposal for generic in go

2016-06-28 Thread Egon
On Wednesday, 29 June 2016 01:51:58 UTC+3, Mandolyte wrote: > > Earlier someone asked about real world examples. The obvious standard > library was mentioned. It only took me a few seconds to remember Jan > Mercl's interval package. A quick look suggests that the current 1200+ > lines of code wo

[go-nuts] Where can I find the format definition of stack trace?

2016-06-28 Thread Jingguo Yao
Invoking https://golang.org/pkg/runtime/debug/#PrintStack produces the following result: goroutine 35 [running]: runtime/debug.Stack(0x0, 0x0, 0x0) /usr/local/go/src/runtime/debug/stack.go:24 +0x80 runtime/debug.PrintStack() /usr/local/go/src/runtime/debug/stack.go:16 +0x18 github.

Re: [go-nuts] 'Vectorizing' array arithmetic using parallel for loops?

2016-06-28 Thread Michael Jones
You should expect linear speedup. But you’ll need to work fot it. Problems in this version: 1. 10,000 parallel workers! Not very cache friendly. 2. You don’t wait for the goroutines to finish, so not very meaningful. Look for the blog posts and videos about concurrently patterns. What you likely

[go-nuts] 'Vectorizing' array arithmetic using parallel for loops?

2016-06-28 Thread guyzys7
Hi, I'm attempting to optimize pair-wise operations over arrays of big integers ('vectorize'). Currently, I tried creating two versions of a point-wise multiplication function - one that is a simple serial for-loop, and another that uses go-routines to create a parallel (or more correctly - con

[go-nuts] Prevent RTS from creating an OS thread

2016-06-28 Thread Martynas Pumputis
Hi list, Recently I've bumped into a problem when using the Linux network namespaces in Go. In my program I have the following function: func do() { runtime.LockOSThread() defer runtime.UnlockOSThread() netns.Set(containerNs) defer netns.Set(hostNs) doSomeStuff() } where net

Re: [go-nuts] Automatic type assertion

2016-06-28 Thread Pablo Rozas-Larraondo
Nice one! Thanks for sharing Pablo On Friday, June 24, 2016 at 6:56:58 AM UTC+10, Jose Luis Aracil wrote: > > > I use my own "automatic" type assertion library: > > https://github.com/jaracil/ei > > El jueves, 9 de junio de 2016, 22:39:46 (UTC+2), Pablo Rozas-Larraondo > escribió: >> >> Sorry I

[go-nuts] Re: A proposal for generic in go

2016-06-28 Thread Mandolyte
Earlier someone asked about real world examples. The obvious standard library was mentioned. It only took me a few seconds to remember Jan Mercl's interval package. A quick look suggests that the current 1200+ lines of code would be reduced to about 250. If this sort of code is written very oft

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-06-28 Thread Tamás Gulácsi
Don't forget io.Pipe: an easy way to transform a Reader to a Writer, or vice versa, if that makes it easier. For example read in a loop into a big, replace as you wish, and write the result to a pipe. And return the reader pair of the pipe. This way you don't have to account the reader's bufferin

Re: [go-nuts] Re: formal verification in Go? someday perhaps?

2016-06-28 Thread Daniel Skinner
Yeah, I just ultimately decided nothing I do actually warrants formal verification. Even looking at a naive example like the TestDilate8 and TestDilate16 funcs from here, https://github.com/dskinner/octree/blob/master/octree_test.go I prefer consistency over exhaustiveness, where the TesDilate8 was

Re: [go-nuts] Question - type assertion x.(*T)

2016-06-28 Thread 'Axel Wagner' via golang-nuts
For example: By necessity, bufio.Writer can't satisfy io.Writer, because the Write method needs to modify internal state (namely, the buffer), so you need to put a *bufio.Writer into that interface for it to make sense. Now, if you do a bufio.NewWriter(w), with w being a *bufio.Writer, then it woul

Re: [go-nuts] Return different structs

2016-06-28 Thread Shawn Milochik
You could return an interface, or a []byte. -- 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 http

[go-nuts] Return different structs

2016-06-28 Thread jbogarin
Hello, I'm having a hard time figuring out if it's possible to return a function but having different structs as the return type. I'm talking to a REST API that does something like this: GET /endpoint?option=1 { "fieldA": 1, "fieldB": 2 } GET /endpoint?option=2 { "fieldA": 1, "fieldC":

Re: [go-nuts] Go application hanging and throwing Proxy error: Request Canceled or I/O timeout

2016-06-28 Thread Shawn Milochik
On Tue, Jun 28, 2016 at 9:10 AM, wrote: > Thanks Shawn. Increasing the maxidleconnectionperhost is my next option. > Will there be any issue due to increasing this? > I haven't had any issues with running out of file handles or "can't assign requested address" messages after making that change.

Re: [go-nuts] Urlwatch

2016-06-28 Thread Tong Sun
Just want to get into the loop for future updates... On Saturday, June 25, 2016 at 9:08:23 AM UTC-4, Mohammad Nasirifar wrote: > > Btw I would like to work on that! > > On Saturday, June 25, 2016 at 5:11:34 PM UTC+4:30, Henrik Johansson wrote: >> >> Cache headers, etags etc and dynamic scheduling

[go-nuts] Text streaming

2016-06-28 Thread Tong Sun
I'm looking for something like that simple interface too. Please let me know if you have come up with something similar or found one. Thx. On Tuesday, June 28, 2016 at 8:37:35 AM UTC-4, mhhcbon wrote: > > Yes i was referring to node. > > *Really just to illustrate*, (don't slap : ) this is what

[go-nuts] Re: 'go tool pprof' only shows "Type: CPU" and not a callgraph

2016-06-28 Thread Kyle Stanly
Very educational slides, I'll save for later, thanks. On Monday, June 27, 2016 at 5:54:23 PM UTC-4, Dave Cheney wrote: > > What are the exact commands you used? > > It is easy to misuse proof, here is a slide with some of the gotchas. > > > http://talks.godoc.org/github.com/davecheney/presentation

Re: [go-nuts] Re: 'go tool pprof' only shows "Type: CPU" and not a callgraph

2016-06-28 Thread Kyle Stanly
Apologies, it definitely was a rather quick and "lazy" no-effort post, so it's my fault, and I apologize for not getting back sooner. The Go version I am using is custom, and also was built with 'all.bat', however, while it built go tools it only had 'asm', 'cgo', 'compile', 'dist', 'go_bootstr

Re: [go-nuts] Re: formal verification in Go? someday perhaps?

2016-06-28 Thread Scott Cotton
A model check in a test file is a great idea. In fact, one of the hot topics of formal technologies is automatic test generation (at least in the hardware world). 2016-06-28 15:33 GMT+02:00 Daniel Skinner : > Actually, I was thinking there's probably something in gonum more suitable > than expr

Re: [go-nuts] Re: formal verification in Go? someday perhaps?

2016-06-28 Thread Daniel Skinner
Actually, I was thinking there's probably something in gonum more suitable than expressing it as a linear program. When I do searches for boolean satisfiability problem for example, simplex is not what's mentioned in papers. From what I have understood (I'm by no means an expert in any of this), it

Re: [go-nuts] GO on ppc64 platform!

2016-06-28 Thread Ian Lance Taylor
On Tue, Jun 28, 2016 at 1:05 AM, Leno Hou wrote: > I'm facing the problem using go-1.6.2 when building docker on ppc64 > platform. Could anyone help me ? thanks~ This looks to me like problems in the Docker source code. I don't see any problems with the Go standard library, just with names that

Re: [go-nuts] Go application hanging and throwing Proxy error: Request Canceled or I/O timeout

2016-06-28 Thread dkbalachandar
Thanks Shawn. Increasing the maxidleconnectionperhost is my next option. Will there be any issue due to increasing this? On Tuesday, 28 June 2016 00:29:57 UTC-4, Shawn Milochik wrote: > > I don't have any insight as to why it's suddenly happening when you change > Go versions, but I've run into

[go-nuts] Package Pointer context-sensitive heap

2016-06-28 Thread Ran Ailla
I am starting to understand the pointer package. I already know the most definitions like inclusion-based, flow-insensitive, context-sensitive and so on. Unfortunaley I am struggeling with the context-sensitive heap. Does it mean that *f1 := f()* and *f2() := f()* can be distinguished because

[go-nuts] [ANN] An IMAP library written in Go. It can be used to build a client and/or a server and supports UTF-7.

2016-06-28 Thread emersion
Hi! I've been working for a couple of weeks on yet another IMAP library. I know there are already some libraries in Go available, but they all have drawbacks (explained in the README). All commands from RFC 3501 are implemented, plus some extensions like MOVE and COMPRESS. If you're interested

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-06-28 Thread mhhcbon
Yes i was referring to node. *Really just to illustrate*, (don't slap : ) this is what i had in head when i started to dig this problem, fs.createReadStream("some.file") .on('error', console.error.bind(console)) .pipe(split(/\r?\n/)) .pipe(through(function (byteData, enc, next) { next(null, by

[go-nuts] GO on ppc64 platform!

2016-06-28 Thread Leno Hou
I'm facing the problem using go-1.6.2 when building docker on ppc64 platform. Could anyone help me ? thanks~ Following is the full log. >>> Emerging (1 of 1) app-emulation/docker-1.11.0::gentoo >>> Downloading 'http://distfiles.gentoo.org/distfiles/docker-1.11.0.tar.gz' --2016-06-28 15:32:17-

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-06-28 Thread mpvl
On Tue, Jun 28, 2016 at 12:36 PM, mhhcbon wrote: > > > This does not work in cases where someone want to use a Transformer in > a streaming context (e.g. to create a Reader or Writer or to include the > Transform in a Chain). > > This really is what i was looking to implement, somehow, > > src ->

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-06-28 Thread mhhcbon
> > This does not work in cases where someone want to use a Transformer in a streaming context (e.g. to create a Reader or Writer or to include the Transform in a Chain). This really is what i was looking to implement, somehow, src -> transform -> transform -> sink > I've used bufio.Scanner t

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-06-28 Thread Tamás Gulácsi
I've used bufio.Scanner to implement a custom transforming stream reader. -- 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

[go-nuts] [ANN] moved github organization zalando-techmonkeys - Gin middleware projects

2016-06-28 Thread Sandor Szuecs
Hi! We moved our Gin[1] middleware projects[2,3,4] from zalando-techmonkeys to zalando [5,6,7], so if you use one of them please rename your imports. In gin-oauth2 we have a new feature implemented, Google OAuth2 is now available. [1] https://github.com/gin-gonic/gin [2] https://github.com/zalan

Re: [go-nuts] Question - type assertion x.(*T)

2016-06-28 Thread Jan Mercl
On Tue, Jun 28, 2016 at 11:13 AM Michael Wain wrote: > Why would I use *T over just T ? Consider this program package main import ( "fmt" ) type T int func main() { var a, b T = 42, 314 var i, j interface

Re: [go-nuts] Question - type assertion x.(*T)

2016-06-28 Thread Michael Wain
Why would I use *T over just T ? Michael > On 28 Jun 2016, at 10:05, Jan Mercl <0xj...@gmail.com> wrote: > > On Tue, Jun 28, 2016 at 11:02 AM Michael Wain > wrote: > > > So a := x.(*T) is the same as a := x.(T) ? > > No, because T and *T are distinct types. > > > > -- > -j -- You recei

Re: [go-nuts] Question - type assertion x.(*T)

2016-06-28 Thread Jan Mercl
On Tue, Jun 28, 2016 at 11:02 AM Michael Wain wrote: > So a := x.(*T) is the same as a := x.(T) ? No, because T and *T are distinct types. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop recei

Re: [go-nuts] Question - type assertion x.(*T)

2016-06-28 Thread Michael Wain
So a := x.(*T) is the same as a := x.(T) ? Michael > On 27 Jun 2016, at 23:33, Axel Wagner wrote: > > Hm? It's this syntax: > https://golang.org/ref/spec#Type_assertions > using *T as the type. > >> On Mon, Jun 27, 2016 at 11:08 PM, wrote: >> Hi, >> >> Reading through gaoling spec regarding

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-06-28 Thread mpvl
This does not work in cases where someone want to use a Transformer in a streaming context (e.g. to create a Reader or Writer or to include the Transform in a Chain). It may we useful to add something like strings.Replacer in runes as well. Alternatively, I have once implemented a generic rewrite

Re: [go-nuts] Race in text/collate?

2016-06-28 Thread mpvl
The Buffer is to avoid allocations, not to work around a stateless Collator. This could be clarified perhaps. On Mon, Jun 13, 2016 at 8:52 PM, Sugu Sougoumarane wrote: > I think the Go norm of assuming that things are not thread-safe unless > stated otherwise makes sense. > In this particular ca

Re: [go-nuts] Re: formal verification in Go? someday perhaps?

2016-06-28 Thread Seb Binet
On Tue, Jun 28, 2016 at 12:24 AM, Daniel Skinner wrote: > > I think a better question is: can go tools for formal verification > become available? > > I did some research on formal verification recently, no experience > previously. I don't really see why not. Just digging through my own code, I

Re: [go-nuts] Re: Shuffle Items in a Slice

2016-06-28 Thread Kaveh Shahbazian
Thanks for the reference! BTW I love this behaviour! On Tue, Jun 28, 2016, 00:14 Chris Hines wrote: > The history of this behavior is explained in the release notes for Go 1.3: > https://golang.org/doc/go1.3#map > > > On Friday, June 24, 2016 at 8:48:20 AM UTC-4, Val wrote: >> >> 2 implementatio

[go-nuts] Re: Why there's no arithmetic process for sets?

2016-06-28 Thread Egon
On Monday, 27 June 2016 17:32:08 UTC+3, Wang Yarco wrote: > > First, i should say very sorry to you, guys. (It is also not for golang > itself, but i think you may have interests on this. Just for some advice) > Original Post >