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 Itera

[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] x/crypto/ssh exception trying to parse RSA public Key

2021-03-08 Thread Florian Rinke
Hi all, When Using the golang.org/x/crypto/ssh module to connect to a lshd SSH server this error gets thrown: panic: ssh: handshake failed: ssh: exponent too large goroutine 1 [running]: main.main() C:/Users/user/Documents/project/sample.go:33 +0x685 EOF It's defined in /ssh/k

[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) { _, _, er

[go-nuts] Re: unsafe pointer arithmetics - slow code

2018-08-24 Thread 'Florian Uekermann' via golang-nuts
I've opened an issue: https://github.com/golang/go/issues/27180 -- 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

Re: [go-nuts] Re: Garbage collector and Slices

2018-08-22 Thread 'Florian Uekermann' via golang-nuts
On Tuesday, August 21, 2018 at 7:31:28 AM UTC+2, Keith Randall wrote: > > There is no conservativeness to unsafe.Pointer. The type information for > any object in the heap is recorded at allocation time, and is unrelated to > the type of the reference currently held to it (be it unsafe.Pointer,

[go-nuts] Re: unsafe pointer arithmetics - slow code

2018-08-22 Thread 'Florian Uekermann' via golang-nuts
> > Another question: Why does the nil check take two instructions. Can't it > be done using MOVQ? > Scratch that. That was nonsense. -- 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

[go-nuts] Re: unsafe pointer arithmetics - slow code

2018-08-22 Thread 'Florian Uekermann' via golang-nuts
Forgot the ssa.html -- 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://groups.google.com/d/

[go-nuts] unsafe pointer arithmetics - slow code

2018-08-22 Thread 'Florian Uekermann' via golang-nuts
or further analysis. Another question: Why does the nil check take two instructions. Can't it be done using MOVQ? Best regards, Florian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receivin

Re: [go-nuts] Re: Garbage collector and Slices

2018-08-20 Thread 'Florian Uekermann' via golang-nuts
> > From the GC POV, the only interesting thing about an unsafe.Pointer is if > its value falls anywhere into a GC managed memory block for liveness > analysis, AFAIK. > And then it will check that memory block for stuff that looks like a pointer (not caring what the actual type being pointed t

Re: [go-nuts] Re: Garbage collector and Slices

2018-08-20 Thread 'Florian Uekermann' via golang-nuts
> > The garbage collector does not care about the values of items of a []T > when T is not a pointer type nor a type containing transitively any > pointers. > Just to make sure I understand you correctly. Are you saying I could hold an unsafe.Pointer to an array of uint64 and the GC will still

Re: [go-nuts] Re: Garbage collector and Slices

2018-08-20 Thread 'Florian Uekermann' via golang-nuts
Thanks Axel. Good to know the first part. I have a couple of comments regarding your answer to the second part. In regards to your second question: That would require having an array type > for every possible size, which isn't really tenable. > The idea was to use the same array type (`[(^uint

[go-nuts] Re: Garbage collector and Slices

2018-08-20 Thread 'Florian Uekermann' via golang-nuts
Mistake in the second struct. The data field should have the type: *[(^uint(0)) >> 17]uint64 -- 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

[go-nuts] Garbage collector and Slices

2018-08-20 Thread 'Florian Uekermann' via golang-nuts
m favoring that at the moment. Best regards, Florian -- 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://groups.google.com/d/optout.

[go-nuts] Re: Why are can't struct field types not be used as types

2017-12-09 Thread florian
> > x := T{}.F Thanks. Good idea. That doesn't work in most cases though (function arguments/returns or type definitions for example). -- 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] Why are can't struct field types not be used as types

2017-12-09 Thread 'Florian Uekermann' via golang-nuts
that this has been discussed previously, but I couldn't find it. It would be great if someone could provide a link. Best regards, Florian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop r

Re: [go-nuts] Extending image.Image with Set

2017-09-06 Thread Florian
form > > On 4 September 2017 at 08:54, Florian Florensen > wrote: > >> Hello, >> >> I'd like to rotate, scale, ... images by moving pixels using affine >> transformations. For example, the get a points x, y position after a >> translating it by

Re: [go-nuts] Re: Splitting CamelCaseWords in Go

2017-09-05 Thread Florian Florensen
I didn't write tests. Sorry for that! I still would use Seths version, since it correctly splits uppercase-words like CAMELCase to ["C" "A" "M" "E" "L" "Case"]. Am Dienstag, 5. September 2017 03:43:22 UTC+2 schrieb Tong Sun: >

[go-nuts] Re: Splitting CamelCaseWords in Go

2017-09-04 Thread Florian Florensen
Hi, two approaches would be: func camelAppend(str string) string { w := []rune(str) for i := len(w) - 1; i > 1; i-- { if unicode.IsUpper(w[i]) { w = append(w[:i], append([]rune{' '}, w[i:]...)...) } } return string(w) } func camelRegexp(str string) string { re := regexp.Mu

[go-nuts] Extending image.Image with Set

2017-09-04 Thread Florian Florensen
Hello, I'd like to rotate, scale, ... images by moving pixels using affine transformations. For example, the get a points x, y position after a translating it by m, n pixels, you can just add m resp n to x and y: x' = x + m y' = y + n So the task is basically just to iterate over the images p

Re: [go-nuts] go get awkwardness with packages outside of GOPATH

2017-07-20 Thread 'Florian Uekermann' via golang-nuts
fail to see the problem. Could you elaborate if I misunderstood you? Best regards, Florian -- 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-nut

Re: [go-nuts] go get awkwardness with packages outside of GOPATH

2017-07-20 Thread 'Florian Uekermann' via golang-nuts
ide a way to update dependencies of packages that are not go get-able. Inside or outside GOPATH has nothing to do with it. Thanks, Florian -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving

[go-nuts] Re: go get awkwardness with packages outside of GOPATH

2017-07-19 Thread florian
I always forget that there is no edit button... sorry for not proofreading thoroughly before posting. -- 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

[go-nuts] go get awkwardness with packages outside of GOPATH

2017-07-19 Thread 'Florian Uekermann' via golang-nuts
ot;go build". Then "go get -d && go build -u -i" would work great. I know that none of these exactly fit the original idea of the "get" or "build" command perfectly, but this is a real world problem in need of a solution. tldr: Please let me update depe

[go-nuts] go generate, go run, and cross compilation with GOOS

2017-05-16 Thread florian
e environment in a script is no solution, as the point of the whole change is not to use a script. go generate doesn't provide any way to set environment variables. Best regards, Florian -- You received this message because you are subscribed to the Google Groups "golang-nuts" g

[go-nuts] Cancelling a server routine

2017-03-21 Thread Florian Forster
Hi Go nuts, I have a (server) function that gets a context.Context and *listens* on a net.UDPConn. I would like this function to receive and handle network packets, but close the socket and return as soon as the context is cancelled. Ideally, I'd like to do something along these lines: for {

[go-nuts] http: Empty pattern

2017-01-27 Thread 'Florian Uekermann' via golang-nuts
code, since providing "" as a pattern results in a panic at the moment. What did I miss? Best regards, Florian -- 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://groups.google.com/d/optout.

[go-nuts] Re: write barrier and C types

2016-12-24 Thread 'Florian Uekermann' via golang-nuts
de this in some garbage collected languages, so I decided to close the issue. On Sunday, December 18, 2016 at 8:13:39 PM UTC+1, Florian Uekermann wrote: > > Well, I am pretty sure I was wrong about something. Turning of the garbage > collector results in no error. Any smart ideas for debug

[go-nuts] Re: write barrier and C types

2016-12-18 Thread 'Florian Uekermann' via golang-nuts
Well, I am pretty sure I was wrong about something. Turning of the garbage collector results in no error. Any smart ideas for debugging this? On Sunday, December 18, 2016 at 4:20:25 PM UTC+1, Florian Uekermann wrote: > > I may be misdiagnosing the problem, but I think go is doing a probl

[go-nuts] Re: write barrier and C types

2016-12-18 Thread 'Florian Uekermann' via golang-nuts
I forgot to ask another question. If solving this is not practical in go, should I bring this up with the Vulkan people? I don't really understand why they don't use uint64_t regardless of architecture. -- You received this message because you are subscribed to the Google Groups "golang-nuts"

[go-nuts] write barrier and C types

2016-12-18 Thread 'Florian Uekermann' via golang-nuts
I may be misdiagnosing the problem, but I think go is doing a problematic check of the value of C pointer types pointers. The following runtime error is reproducible, but does not always happen in a program: runtime: writebarrierptr *0xc420326a90 = 0x12 fatal error: bad pointer in write barrie

Re: [go-nuts] fatal error: bad pointer in write barrier

2016-12-02 Thread 'Florian Uekermann' via golang-nuts
> > You wrote `*X.Y`; I'm going to assume you meant to write `*X = Y`. > *X.Y = value , where the Y field is a pointer to the C heap. But I suppose that is pretty much the same. > This error message is telling you that in the assignment `*X = Y` Y > has a pointer type, but has the value 1.

[go-nuts] fatal error: bad pointer in write barrier

2016-12-01 Thread 'Florian Uekermann' via golang-nuts
ersion of Go are you using (`go version`)? $ go version go version go1.7.3 linux/amd64 ### What operating system and processor architecture are you using (`go env`)? $ go env GOARCH="amd64" GOBIN="" GOEXE="" GOHOSTARCH="amd64" GOHOSTOS="linux" GO

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 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/golang subreddit. >>> &g

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

2016-11-24 Thread Florian Hines
On /r/fantasy and /r/books I've gotten the chance to interact with some of my favorite authors...not just on special occasions but because they're core members of the community. On /r/woodworking people were endlessly helpful when I tried to pick up woodworking as a hobby. When school starts red

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 resource

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 receiv

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 li

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 > conv

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 complain

[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 R

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

2016-10-30 Thread Florian Weimer
* Clark Wierda: > I don't have specific answers, but I do have some thoughts. > > First, the externally parallel has no overhead related to coordination. I > would expect you to get the result you have of full core utilization and > nearly perfect scaling. GNU parallel saves intermediate outpu

[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 betw

[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 pu