Re: [go-nuts] The docs for secretbox seem very wrong

2023-10-09 Thread Dean Schulze
If the docs are correct, how do you append to nil? That's what the docs say. Take a look at them. Your code example shows the first parameter to Seal() can be nil. So what does that parameter do? How do you append to it? On Sunday, October 8, 2023 at 11:19:13 PM UTC-6 Axel Wagner wrote: >

Re: [go-nuts] The docs for secretbox seem very wrong

2023-10-09 Thread Bruno Albuquerque
Now including the list and hopefully with less typos. :) append returns a new slice. Appending to nil just means that you are guaranteed that the returned slice will be allocated inside the append function. The same happens if you try to append to a slice that does not have enough capacity to

Re: [go-nuts] The docs for secretbox seem very wrong

2023-10-09 Thread 'Axel Wagner' via golang-nuts
I get the impression that the thing you are missing is that appending to a slice does not modify it. That is, `append(s, x...)` modifies neither the length, nor the content of `s`, you have to type `x = append(s, x...)`. `Seal` (and `Open`) work exactly the same. They append to the `out` parameter

Re: [go-nuts] The docs for secretbox seem very wrong

2023-10-09 Thread Jan Mercl
On Mon, Oct 9, 2023 at 3:46 PM Dean Schulze wrote: > If the docs are correct, how do you append to nil? https://go.dev/play/p/WY0Bycj-_Tn -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails

Re: [go-nuts] The docs for secretbox seem very wrong

2023-10-09 Thread Dean Schulze
So why even bother with the first parameter then? That looks like a badly designed method signature. On Monday, October 9, 2023 at 8:12:33 AM UTC-6 Axel Wagner wrote: > I get the impression that the thing you are missing is that appending to a > slice does not modify it. That is, `append(s,

[go-nuts] how do you compie and link a go main with an assembly code file?

2023-10-09 Thread Peter Riemenschneider
I tried to recreate the simplest example: testAdd.go: package main func main () { _ = add(3,5) } addAsm.s: TEXTmain.add(SB), NOSPLIT|NOFRAME|ABIInternal, $0-16 ADDQBX, AX RET I can compile the first program with: go tool compile testAdd.go I can run the assembler: go tool asm

Re: [go-nuts] Ping on CL bringing AES speedup in CTR mode

2023-10-09 Thread מיקי קצב
נא להכניס את המייל שלי כי אני לא מצליח ב-יום שלישי, 26 בספטמבר 2023 בשעה 19:46:29 UTC+3, Nagaev Boris כתב/ה: > Hi folks! > > I updated the CL https://go-review.googlesource.com/c/go/+/413594 to fix > the finding of the LUCI bot. Please take another look :) > > On Sun, Sep 10, 2023 at 6:49 PM

Re: [go-nuts] how do you compie and link a go main with an assembly code file?

2023-10-09 Thread Jan Mercl
On Mon, Oct 9, 2023 at 6:02 PM Peter Riemenschneider wrote: Just '$ go build' as usual, but one must declare the asm function: https://go.dev/play/p/KySqFvCVz_T -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

Re: [go-nuts] The docs for secretbox seem very wrong

2023-10-09 Thread Dean Schulze
That is mixing concerns (low cohesion), though. At the very least they need to explain that in the docs. Otherwise that first parameter makes no sense. On Monday, October 9, 2023 at 2:51:11 PM UTC-6 David Anderson wrote: > The first parameter lets you avoid an allocation. If you're

Re: [go-nuts] The docs for secretbox seem very wrong

2023-10-09 Thread Ian Lance Taylor
On Mon, Oct 9, 2023, 1:59 PM Dean Schulze wrote: > That is mixing concerns (low cohesion), though. At the very least they > need to explain that in the docs. Otherwise that first parameter makes no > sense. > This is a common design pattern in Go. We shouldn't expect that every function that