Re: [go-nuts] Limits of type parameter inference in function calls

2021-11-07 Thread Florian Weimer
* Axel Wagner: > One way to fix this is to change the signatures to > > func Contains[I Iterator[T], T comparable](c I, value T) bool > func Contains2[I Iterator[T], T comparable](value T, c I) bool I had not realized that, thanks. The opposite order is perhaps more useful, [T comparable, I

[go-nuts] Limits of type parameter inference in function calls

2021-11-07 Thread Florian Weimer
I've tried this example, related to the collections example in the proposal. package main type Iterator[T any] interface{ Next() (T, bool) } func Contains[T comparable](c Iterator[T], value T) bool { for { v, ok := c.Next() if ok {

[go-nuts] Issuing a blocking system call

2021-03-03 Thread Florian Weimer
Do I have to tell the runtime that a system call is blocking? For example, I use this code snippet to perform a blocking ioctl: conn, err := file.SyscallConn() if err != nil { return } err1 := conn.Control(func(fd uintptr) { _, _,

Re: [go-nuts] Re: Deleting the /r/golang subreddit

2016-11-24 Thread Florian Weimer
* Dave Cheney: > On Fri, Nov 25, 2016 at 4:24 PM, Florian Weimer <f...@deneb.enyo.de> wrote: >> * Brad Fitzpatrick: >> >>> In light of the CEO of Reddit admitting to editing user comments (see >>> dozen news stories today), I propose we delete the /r/gola

Re: [go-nuts] Re: Deleting the /r/golang subreddit

2016-11-24 Thread Florian Weimer
* Brad Fitzpatrick: > In light of the CEO of Reddit admitting to editing user comments (see > dozen news stories today), I propose we delete the /r/golang subreddit. > > That is so beyond unethical and immature, Was it immature because they didn't make any money out of it, at least not directly?

Re: [go-nuts] SetDeadline for io.Writer - is this right?

2016-11-06 Thread Florian Weimer
* audrius butkevicius: > I am looking for advice how this could be implemented in a more robust way > without leaking resources. You can't with just an io.Writer. If a write operation cannot be canceled (and io.Writer does not provide this capability), a timeout will always result in a

Re: [go-nuts] Re: XML Beautifier that doesn't rewrite the document

2016-11-06 Thread Florian Weimer
* Tong Sun: > The dark voodoo regexp as described here works for many cases. > http://www.perlmonks.org/?node_id=261292 In general, whitespace is significant in XML, so you need a DTD or schema to make sure that you can make such edits without changing the meaning of the document. -- You

Re: [go-nuts] [slightly OT] Is this a known virus written in Go?

2016-11-01 Thread Florian Weimer
* Elazar Leibovich: > Hi, > > I'm the author of the goproxy project. > > Recently I received a complaint from a user about goproxy being categorized > as a virus. > > https://www.reasoncoresecurity.com/sysnetwk.exe-fbcc41dafc7bd8cf9b373e0d6b74808b11a9ba3c.aspx > > From a cursory look, it looks

Re: [go-nuts] CGO: Go string -> void*/length

2016-10-31 Thread Florian Weimer
* Pietro Gagliardi: > Just pass the null-terminated string and use C.int(len(goString)) as > the length. The length of a Go string is already in bytes and does not > include the terminating null (since Go has none), and I assume > C.CString() produces the same byte sequence without encoding >

Re: [go-nuts] Re: Unexpected lack of parallel speedup

2016-10-31 Thread Florian Weimer
* Chris Kastorff: > If your program is spending that much time in GC, then you're likely > spending a lot of time with the pointer write barriers on, which slow > execution (for the benefit of having your code run at all during GC.) Well, it's creating a lot of garbage, so I can't really

[go-nuts] Re: Unexpected lack of parallel speedup

2016-10-30 Thread Florian Weimer
* John Morrice: > Thought I'd be kind and illustrate your bug vs my solution with code. I > use WaitGroups in both examples to keep things clearer. > > Your bug: > https://play.golang.org/p/yoNPmbXnlW > > I.e. > > Ringo wrote Yellow Submarine > Ringo wrote I am the Walrus > Ringo wrote Eleanor

[go-nuts] Unexpected lack of parallel speedup

2016-10-29 Thread Florian Weimer
I'm trying to parse OpenPGP key server dumps. Throughput is not too bad so far, but I'd like to speed things up by introducing parallelism. The dumps are split into several files (each about 40 MB large, with a few thousand keys). The toy version I have so far does not need any coordination

[go-nuts] golang.org/x/crypto/openpgp RSA public exponent size limit

2016-10-29 Thread Florian Weimer
PublicKey.parseRSA() has this check: if len(pk.e.bytes) > 3 { err = errors.UnsupportedError("large public exponent") return } I get that it is valuable to limit the exponent size, but this limit is too low: quite a few RSA keys in a dump from the