[go-nuts] Ignore data race

2022-04-13 Thread Miraddo
Sometimes in some scenarios, we might find that having the data race might be not so bad, my question is how many ways we have to ignore data race in the Golang. I found out with build tags, we could ignore the data race => // +build !race do we have some other ways without building tags? --

[go-nuts] slices grow at 25% after 1024 but why 1024?

2021-09-04 Thread Miraddo
Hey Guys, We know slices grow by doubling until size 1024, the capacity will grow at 25%. The question that I had was why after 1024 elements? Why didn't the developers chose another number like 2048 or other numbers? Thanks, Milad -- You received this message because you are subscribed to

[go-nuts] how golang stores variables in the computer’s memory?

2021-08-17 Thread Miraddo
Hello, Yesterday, I had an awesome interview, and I found I don't know anything about `Golang` in deep, so I decided to learn more about the compiler and memory and every part of `Golang` in deep. I guess I had a lot of questions :) Do you have any reference to know, How `Golang` stores'

Re: [go-nuts] What's going on while using "append" in memory?

2021-08-08 Thread Miraddo
Thanks, Brain. It is absolutely fantastic. I saw this SliceTricks two days ago. Nice to mention it. On Sunday, August 8, 2021 at 8:36:27 PM UTC+4:30 Brian Candler wrote: > On Friday, 6 August 2021 at 18:00:35 UTC+1 Konstantin Khomoutov wrote: > >> Have you read and understood [1] and [2]? >> >

Re: [go-nuts] What's going on while using "append" in memory?

2021-08-08 Thread Miraddo
copy the items, and returns the new slice. That is how > you got the new slice. > > If what you need is rotation, you may want to rotate the items manually. > > On Saturday, August 7, 2021 at 12:00:35 AM UTC+7 Konstantin Khomoutov > wrote: > >> On Fri, Aug 06, 2021 at 12:

Re: [go-nuts] What's going on while using "append" in memory?

2021-08-08 Thread Miraddo
d, but now I know what's going on. On Friday, August 6, 2021 at 9:30:35 PM UTC+4:30 Konstantin Khomoutov wrote: > On Fri, Aug 06, 2021 at 12:42:34AM -0700, Miraddo wrote: > > Hi! > > > I can not understand why when we use append, it does not rewrite values > in &g

[go-nuts] What's going on while using "append" in memory?

2021-08-06 Thread Miraddo
Hello all, I can not understand why when we use append, it does not rewrite values in the same address in the memory that it had before, (I'm not sure it "append" problem or the variable | or just my problem for sure :) ) let me explain what I mean, I solve a question in LeetCode (189.