Re: [go-nuts] Re: Atomic pointers to arrays and sequenced-before guarantees for array elements

2022-10-30 Thread 'Keith Randall' via golang-nuts
> Given the above, is it guaranteed that A's stores to X, Y and Z are synchronized-before B's loads from X, Y and Z? Yes. The writes of X, Y, and Z are sequenced before the atomic write to M, the atomic write to M is synchronized before the atomic read of M (assuming the read returns the result

Re: [go-nuts] Re: What's the maximum array length?

2022-10-30 Thread Ian Lance Taylor
On Sun, Oct 30, 2022, 6:38 PM eric...@arm.com wrote: > > That appears to be the primary limit. That including a composite literal > initializer that exceeds that limit, causing a more ambiguous error, > > seems like a related, but secondary, issue. > > Yes, this seems to be a related question, se

Re: [go-nuts] Re: Replace reference path

2022-10-30 Thread Kurtis Rader
I'm curious how often you perform such refactoring? In my experience such changes are extremely rare and usually require other changes due to differences in the API of the two third-party packages . Which means, in my experience, expending effort to automate such import rewrites typically requires

[go-nuts] Re: Replace reference path

2022-10-30 Thread mr....@gmail.com
He doesn't get the job done. 在2022年10月22日星期六 UTC+8 06:20:53 写道: > try https://pkg.go.dev/golang.org/x/tools/cmd/gomvpkg > > > On Friday, 21 October 2022 at 16:58:57 UTC+1 mr@gmail.com wrote: > >> I'm looking for a tool like this, I've searched google and github and >> can't find one, have yo

Re: [go-nuts] Re: What's the maximum array length?

2022-10-30 Thread eric...@arm.com
> That appears to be the primary limit. That including a composite literal initializer that exceeds that limit, causing a more ambiguous error, > seems like a related, but secondary, issue. Yes, this seems to be a related question, see https://github.com/golang/go/issues/9862. If we do not allo

[go-nuts] Re: [security] Go 1.19.3 and Go 1.18.8 pre-announcement

2022-10-30 Thread Thomas Frössman
Would it be possible to get narrower time windows for these security releases? A date without a specified time zone is a span of 48 hours which is impossible for me to plan for. I can't stay up all night or reasonably ask them from others just in case a Go security fix happens to drop at any time

Re: [go-nuts] Race detector question

2022-10-30 Thread Ian Lance Taylor
On Sun, Oct 30, 2022 at 10:16 AM Konstantin Khomoutov wrote: > > | initially, y==0. > | > | goroutine 1: > | x = 42 > | x = 99 > | atomic.Store(&y, 1) > | x = 100 > | > | goroutine 2: > | if atomic.Load(&y) == 1 { > |println(x) > | } > > then would println have been guaranteed to still print 9

Re: [go-nuts] Re: Atomic pointers to arrays and sequenced-before guarantees for array elements

2022-10-30 Thread Konstantin Khomoutov
On Sun, Oct 30, 2022 at 08:47:41AM -0700, jake...@gmail.com wrote: > I would like to give you a definitive answer, but the same question comes > up in https://groups.google.com/g/golang-nuts/c/Gze1TRtdLdc/ and there is > much disagreement and no clear resolution. (The initial question is not >

[go-nuts] Re: Add/Set URL Parameters on the http.Request struct

2022-10-30 Thread 'Prateek Singhal' via golang-nuts
This was to add query parameters but can anyone help me on how to add path parameters like "http://mywebsite.com/:sub-path"; where sub-path is the path parameter having a string value like "about" so the link becomes "http://mywebsite.com/about"; On Friday, December 14, 2018 at 11:30:42 PM UTC+5

Re: [go-nuts] Race detector question

2022-10-30 Thread Konstantin Khomoutov
On Fri, Sep 16, 2022 at 01:26:05PM -0700, 'Keith Randall' via golang-nuts wrote: > Atomic operations can establish happens-before relationships. > > initially, y==0. > > goroutine 1: > x = 99 > atomic.Store(&y, 1) > > goroutine 2: > if atomic.Load(&y) == 1 { >println(x) > } > > This progra

Re: [go-nuts] Atomic pointers to arrays and sequenced-before guarantees for array elements

2022-10-30 Thread burak serdar
Based on my reading of the Go memory model, this algorithm sketch is memory-race free. However, there is a race condition. Here's the reason: The writer issues a synchronized-write to array pointer, and another synchronized-write to the array len. A reader issues a synchronized read. the correspo

Re: [go-nuts] Tracking which connection is used to make an HTTP request

2022-10-30 Thread Christian Worm Mortensen
Hi Konstantin Thanks for the reply - this is exactly what I needed! It even seems like tls.Conn has a function NetConn that allows me to get my net.Conn back again. So for anyone stumbling on this in the future, I think this is the way to solve it: * Make the customer TLS dialer dial a TCP connec

[go-nuts] Re: Atomic pointers to arrays and sequenced-before guarantees for array elements

2022-10-30 Thread jake...@gmail.com
I would like to give you a definitive answer, but the same question comes up in https://groups.google.com/g/golang-nuts/c/Gze1TRtdLdc/ and there is much disagreement and no clear resolution. (The initial question is not exactly yours, but if I understand correctly, the discussion quickly gets s

[go-nuts] Atomic pointers to arrays and sequenced-before guarantees for array elements

2022-10-30 Thread Konstantin Khomoutov
Hi! I would like to receive clarifications, if possible, on Go memory model guarantees about non-atomic load and stores when intermixed with atomic load and stores. I'm reviewing a piece of code which, simplified, works as follows: - There is a single "writer" goroutine which - Allocates a

Re: [go-nuts] filepath.walk in Go 1.19

2022-10-30 Thread Konstantin Khomoutov
On Sat, Oct 29, 2022 at 02:54:48PM -0700, Robert Solomon wrote: [...] >>> On ubuntu 22.04, I would like the walk function to NOT follow symlinks to >>> other filesystems. The find command uses the -xdev switch to achieve >>> this. >>> >>> How can I get walk to behave like the -xdev switch to fin