[go-nuts] Why there is no net.ListenContext?

2023-12-19 Thread Michał Matczuk
If you take a look at net.Listen implementation func Listen(network, address string) (Listener, error) { var lc ListenConfig return lc.Listen(context.Background(), network, address) } you will notice the new listen API net.ListenConfig. This API is context aware, I think it would be hand

[go-nuts] Invitation to join Golang Struct Community

2023-12-19 Thread Manish Rai Jain
Hey Gophers! I'm Manish, creator of Dgraph, Badger, Ristretto, and Sroar. As a Gopher since 2014, I've always been passionate about our community and how we connect. Let's face it, current chat platforms just don't cut it. They're often cluttered, confusing, and not great for productive convers

[go-nuts] unnecessary zeroing in reflectdata.fillptrmask

2023-12-19 Thread Ge
Src: https://github.com/golang/go/blob/1d4b0b6236febe0646d8d7b0103da5d169f185cc/src/cmd/compile/internal/reflectdata/reflect.go#L1568-L1594 ``` func dgcptrmask(t *types.Type, write bool) *obj.LSym { ... ptrmask = make([]byte, n) fillptrmask(t, ptrmask) ... } func fillptrmask(t *t

Re: [go-nuts] Generic assembly function

2023-12-19 Thread David Finkel
On Thu, Dec 14, 2023 at 10:43 PM Clément Jean wrote: > Hi, > > I'm currently learning how to write Go assembly on arm64 and I made the > following functions: > > TEXT ·AddVector16(SB),NOSPLIT,$0-48 > MOVD a+0(FP), R0 > MOVD a+8(FP), R1 > MOVD a+16(FP), R2 > MOVD a+24(FP), R3 > VMOV R0, V0.D[0] >

[go-nuts] Re: Why there is no net.ListenContext?

2023-12-19 Thread Michał Matczuk
The context is passed downstream but cancelling it seems to have no effect. I guess that the reason why it's not exported. Can anyone shed more light on it? wtorek, 19 grudnia 2023 o 11:59:49 UTC+1 Michał Matczuk napisał(a): > If you take a look at net.Listen implementation > > func Listen(net

[go-nuts] circular package dependency between golang.org/x/mod and golang.org/x/tools

2023-12-19 Thread Nathan Lacey
I noticed that we have a circular dependency between golang.org/x/mod and golang.org/x/tools golang.org/x/mod zip/zip_test.go includes golang.org/x/tools I think we could get rid of the circular package dependency by changing that unit test to remove the dependency to tools/txtar . -- You re

Re: [go-nuts] circular package dependency between golang.org/x/mod and golang.org/x/tools

2023-12-19 Thread Jan Mercl
On Tue, Dec 19, 2023 at 9:37 PM Nathan Lacey wrote: > I noticed that we have a circular dependency between golang.org/x/mod and > golang.org/x/tools > > golang.org/x/mod zip/zip_test.go includes golang.org/x/tools > I think we could get rid of the circular package dependency by changing that

Re: [go-nuts] Re: Why there is no net.ListenContext?

2023-12-19 Thread 'Axel Wagner' via golang-nuts
You can use `ListenConfig.Listen` to do this: https://pkg.go.dev/net#ListenConfig.Listen I believe the reason to do it this way was the realization that there will probably be more ways to set up listening in the future and having lots of different ListenFoo functions in the package would overload

Re: [go-nuts] Re: Why there is no net.ListenContext?

2023-12-19 Thread 'Axel Wagner' via golang-nuts
Hm, reading again, I don't think I actually understand your question. You clearly are ListenConfig aware. But what do you mean with "the same way we have Dial and DialContext"? These are methods on Dialer, so ISTM that there is indeed a pretty clear correspondence. Except that Dialer.Dial has been

Re: [go-nuts] circular package dependency between golang.org/x/mod and golang.org/x/tools

2023-12-19 Thread Rob Pike
If it's only in the test, the circularity only arises when testing both packages in a single build. That doesn't happen so is not a problem at all, and in fact the stdlib is full of such circularities involving common packages like fmt. -rob On Wed, Dec 20, 2023 at 7:49 AM Jan Mercl <0xj...@gma

Re: [go-nuts] Generic assembly function

2023-12-19 Thread Clément Jean
That's what I thought. When I checked the assembly of a generic function I could see the go.shape part and that's what made me think about specialisation. However, after trying to write that myself it just didn't compile. I guess, I'll have to do lot of copy pasting ^^ On Wednesday, December 20

Re: [go-nuts] Generic assembly function

2023-12-19 Thread Clément Jean
Btw, the assembly code was quite terrible... Here is a new version of it for people interested (feedback still welcomed): TEXT ·AddVector16(SB),NOSPLIT,$0-48 MOVD $a+0(FP), R0 VLD1.P 32(R0), [V0.D2, V1.D2] VADD V1.B16, V0.B16, V0.B16 MOVD $ret+32(FP), R0 VST1.P [V0.D2], (R0) RET TEXT ·AddVector3

[go-nuts] Go 1.22 Release Candidate 1 is released

2023-12-19 Thread announce
Hello gophers, We have just released go1.22rc1, a release candidate version of Go 1.22. It is cut from release-branch.go1.22 at the revision tagged go1.22rc1. Please try your production load tests and unit tests with the new version. Your help testing these pre-release versions is invaluable. Re

[go-nuts] Strange redirect behavior with http.StripPrefix

2023-12-19 Thread 'Christian Stewart' via golang-nuts
Hi all, I was very confused by the behavior I was seeing while testing a simple program with http.StripPrefix: package main import ( "fmt" "net/http" ) func main() { mux := http.NewServeMux() mux.HandleFunc("/other/", func(w http.ResponseWriter, r *http.Request) { fmt.Println(r.URL.Path) w.Writ

[go-nuts] Re: Strange redirect behavior with http.StripPrefix

2023-12-19 Thread j2gg0s
Why this happens: 1. http.StripPrefix chang reuqest's path from /some/other/path to other/path 2. ServerMux.Handler will return 301 when cleanPath(r.URL.Path) != r.URL.Path Link: https://github.com/golang/go/blob/go1.21.5/src/net/http/server.go#L2467 This seems to be a issue with ServerMux, Our