[go-nuts] Re: Difference between cmd/compile/internal/syntax/parser.go and pkg/go/parser/parser.go

2021-03-27 Thread aind...@gmail.com
I won't speak for the maintainers of cmd/compile/internal/syntax, but packages in the standard library have to be backwards compatible with previous releases. This makes it difficult to make changes to its interface (possibly for performance reasons) and major re-architectures of its implementa

Re: [go-nuts] I'm missing godoc for local packages after converting to modules.

2021-03-27 Thread Kurtis Rader
On Sat, Mar 27, 2021 at 4:55 PM Hotei wrote: > Could use a little help figuring out how to attack the following problem: > > I normally run godoc locally with $godoc -http=":6060"& and then browse it > with chrome. > > Many years ago that method broke for a while as godoc was "reinvented" > but

[go-nuts] io/fs adapters?

2021-03-27 Thread aind...@gmail.com
For testing library functions that accept fs.FS, I've been creating mock FS implementations. However, I'm surprised by the amount of code I've had to write for something like an FS with a single file in it. See below: *type singleFileFS struct {* *f stringFile* *}* *func (r singleFileFS) Op

Re: [go-nuts] Cannot use messageBody (type []byte) as type byte in append ?

2021-03-27 Thread Kurtis Rader
On Sat, Mar 27, 2021 at 6:55 PM Perry Couprie wrote: > I created the following test code. To isolate the compile error. > > Why do i get the error message : > > cannot use messageBody (type []byte) as type byte in append. > Because the append function takes a variadic list of of elements to appe

Re: [go-nuts] syscall.NewCallback, floats and Windows

2021-03-27 Thread RP Junior
May want to check out this setting on your issue: "cmd/internal/obj: reject splittable ABIInternal functions without morestack spill info (e.g., asm functions) because we can't generate a correct morestack path " Unless of course you don't want to use asm functions On Thursday, March 25, 2021 a

[go-nuts] Cannot use messageBody (type []byte) as type byte in append ?

2021-03-27 Thread Perry Couprie
I created the following test code. To isolate the compile error. Why do i get the error message : cannot use messageBody (type []byte) as type byte in append. Greeting from Amsterdam, Perry package main import ( "encoding/hex" "fmt" ) func encodeMessage(messageBody []byte) ([]byte) { tmp,_

[go-nuts] Difference between cmd/compile/internal/syntax/parser.go and pkg/go/parser/parser.go

2021-03-27 Thread philne...@gmail.com
Hey folks, Why does Go reimplement the parser in pkg/go/parser on top of the one in cmd/compile/internal? Why have two packages with somewhat duplicate code? My guess is that it's easier to control what is public-public (available to authors of Go programs) vs public within the compiler by havi

[go-nuts] I'm missing godoc for local packages after converting to modules.

2021-03-27 Thread Hotei
Could use a little help figuring out how to attack the following problem: I normally run godoc locally with $godoc -http=":6060"& and then browse it with chrome. Many years ago that method broke for a while as godoc was "reinvented" but then it came back pretty much the same as before. A few

[go-nuts] How to stream across json-seq RFC-7464

2021-03-27 Thread Greg Saylor
Good afternoon, For a case where there's a file containing a sequence of hashes (it could be arrays too, as the underlying object type seems irrelevant) as per RFC-7464. I cannot figure out how to handle this in a memory efficient way that doesn't involve pulling each blob I've tried to expr

Re: [go-nuts] Re: Parallel Matrix Multiplication

2021-03-27 Thread jasmuth
Don't use that code - instead pick up something modern and well-supported like https://www.gonum.org/ On Sat, Mar 27, 2021 at 3:23 PM Gabriel Pcklub wrote: > thanks for explanation, well, how can I change that code, so it will take > count of Threads (or gorutines) instead size of matrix for one

Re: [go-nuts] Re: Parallel Matrix Multiplication

2021-03-27 Thread Gabriel Pcklub
So Threshold is Size / Threads? Dátum: štvrtok 25. marca 2021, čas: 19:21:02 UTC+1, odosielateľ: jas...@gmail.com > Blast from the past so it's hard to be sure, but I think that was how many > rows or columns to pick for parallel sub matrices to multiply. > > On Thu, Mar 25, 2021, 1:17 PM Gabri

Re: [go-nuts] Re: Parallel Matrix Multiplication

2021-03-27 Thread Gabriel Pcklub
thanks for explanation, well, how can I change that code, so it will take count of Threads (or gorutines) instead size of matrix for one gorutine? Dátum: štvrtok 25. marca 2021, čas: 19:21:02 UTC+1, odosielateľ: jas...@gmail.com > Blast from the past so it's hard to be sure, but I think that wa

[go-nuts] Re: How to wait for HTTP server to start?

2021-03-27 Thread Jérôme LAFORGE
When I want to ensure that the HTTP server is started (or if I want additional stuff), I do this : https://play.golang.org/p/mX0OsNWFf-f Le samedi 27 mars 2021 à 15:13:40 UTC+1, cpu...@gmail.com a écrit : > The typical Go tutorials pattern for starting a server is something like > > log.Fa

Re: [go-nuts] Some questions about the memory allocation strategy of channel

2021-03-27 Thread Paul Zhang
I guess I have misunderstood something about the process of the allocation and gc :) Maybe I need to learn from the gc theory first. BTW thanks for your reply. 在2021年3月20日星期六 UTC+8 上午1:20:12 写道: > On Thu, Mar 18, 2021 at 8:36 PM Paul Zhang wrote: > > > > Can I just understand that for the defa

Re: [go-nuts] Why does the closed status of channel need a uint32?

2021-03-27 Thread 'Axel Wagner' via golang-nuts
Because there are no atomic operations for smaller integers, I assume :) On Sat, Mar 27, 2021 at 4:18 PM Paul Zhang wrote: > For the channel structure: > > type hchan struct { > qcount uint > dataqsiz uint > buf unsafe.Pointer > elemsize uint16 > closed uint32 >

[go-nuts] Why does the closed status of channel need a uint32?

2021-03-27 Thread Paul Zhang
For the channel structure: type hchan struct { qcount uint dataqsiz uint buf unsafe.Pointer elemsize uint16 closed uint32 elemtype *_type sendxuint recvxuint recvqwaitq sendqwaitq lock mutex } Why does the closed need a uint32?

Re: [go-nuts] How to wait for HTTP server to start?

2021-03-27 Thread 'Axel Wagner' via golang-nuts
The best way to do it is probably by making an HTTP request and see if it succeeds. In production, it's always a good idea to have a health check endpoint anyways. So some service manager can check if it's alive and restart it if necessary. Or so that a load balancer doesn't send traffic until the

[go-nuts] How to wait for HTTP server to start?

2021-03-27 Thread cpu...@gmail.com
The typical Go tutorials pattern for starting a server is something like log.Fatal(http.ListenAndServe(":8080")) But what if the application needs to do other things after the server is started? It seems there is virtually no method to wait for the server actually start listening to reques

[go-nuts] Re: What explains this 6x slowdown ?

2021-03-27 Thread Didier Spezia
I suppose the difference between int and int32 comes from the behavior of the modulo strength reduction mechanism. With int (=int64), n%1 is compiled as: MOVQ $0xabcc77118461cefd, AX MOVQ #n, CX IMULQ CX ADDQ CX, DX SARQ $0x1a, DX MOVQ CX, BX SARQ $0x3f, CX SUBQ CX, DX IMULQ $0x5f