[go-nuts] Re: Which websockets implementation

2022-12-19 Thread Jason E. Aten
gorrila/websocket is a very mature library. The current maintainer stepping down doesn't change that. I wouldn't avoid it. The very fact that its been so stable and successful for so long that there's nothing left to do on it is actually a recommendation. Nice tutorial:

Re: [go-nuts] Re: App Engine hasn't upgraded beyond Go 1.16, which is now out of security window

2022-12-19 Thread Sean Abraham
Thanks, folks! I just upgraded my app to the 119 runtime too, and it went very smoothly! On Mon, Dec 19, 2022 at 11:40 AM 'drc...@google.com' via golang-nuts < golang-nuts@googlegroups.com> wrote: > I just checked with my personal app engine project ("gcloud app deploy", > that's app engine, I

[go-nuts] Re: Which websockets implementation

2022-12-19 Thread Juliusz Chroboczek
> By stdlib, you presumably mean the x/net/websocket package, Careful with this library, it's not quite correct. Websocket is a frame-oriented protocol, while x/net/websocket implements a simplistic API that does not always preserve frame boundaries. Correct implementations include:

[go-nuts] Re: Why there are eight bytes pad in the stack frame of main function?

2022-12-19 Thread 'Keith Randall' via golang-nuts
Q1: stack frames are rounded to a multiple of 8 bytes, to keep the stack pointer 8-byte aligned. Part of that is rounding argsize to 8 bytes. (It's not strictly necessary, and we could report 4, I think, if there are no return values.) Q2: I think 4 are from rounding argsize up to 8 bytes, and

Re: [go-nuts] Language idea: Improved support for method-like functions

2022-12-19 Thread 'Axel Wagner' via golang-nuts
On Mon, Dec 19, 2022 at 8:31 PM Red Daly wrote: > Methods cannot take type arguments, so I find myself writing `func Foo(o > Object) {...}` instead of `func (o Object) Foo()` in cases where Foo needs > a type parameter. > > I would like some type of pseudo-method in Go similar to Kotlin's >

Re: [go-nuts] Is OCSP Stapling supported in Go? If so, how?

2022-12-19 Thread 'Sean Liao' via golang-nuts
The standard library itself doesn't do it, but it does provide you with hooks to do so. Set crypto/tls.Config.GetCertificate to an appropriate implementation of OCSP stapling. Examples of ocsp stapling can be found via the package discovery site: https://pkg.go.dev/search?q=ocsp+staple - sean

Re: [go-nuts] the example always fails if the string contains a trailing space before a newline

2022-12-19 Thread 'Sean Liao' via golang-nuts
https://go.dev/issue/26460 - sean On Mon, Dec 19, 2022 at 7:31 PM David M wrote: > Not quite sure if this is a bug but it's annoying: > > If the example tested string contains a trailing space before a newline, > the test always fails no matter how. > // this test passes > func

[go-nuts] Is OCSP Stapling supported in Go? If so, how?

2022-12-19 Thread John Wayne
I tried to google this for a while now, and all I find regarding this topic is: https://groups.google.com/g/golang-nuts/c/QC5FOysyVxg This is already many years old, and to me it seems like there is code inside Go which allows to perform server side OCSP stapling. However, I am unable to find

[go-nuts] the example always fails if the string contains a trailing space before a newline

2022-12-19 Thread David M
Not quite sure if this is a bug but it's annoying: If the example tested string contains a trailing space before a newline, the test always fails no matter how. // this test passes func ExampleFormat() { fmt.Println("a\nb") // Output: // a // b } // this test fails no matter

[go-nuts] Why there are eight bytes pad in the stack frame of main function?

2022-12-19 Thread tarorual
package main func main() { var x int32 = 1 nop(x) } //go:noinline func nop(x int32) {} *Go version: go1.16.15 windows/amd64* I wrote above code and compiled it into assembly with `go1.16.15 tool compile -S -N -l main.go` for truly understanding Go functions call. The following is the

[go-nuts] Language idea: Improved support for method-like functions

2022-12-19 Thread Red Daly
Methods cannot take type arguments, so I find myself writing `func Foo(o Object) {...}` instead of `func (o Object) Foo()` in cases where Foo needs a type parameter. I would like some type of pseudo-method in Go similar to Kotlin's extension methods. Made up syntax: ```go package foo func (o

[go-nuts] Re: App Engine hasn't upgraded beyond Go 1.16, which is now out of security window

2022-12-19 Thread 'drc...@google.com' via golang-nuts
I just checked with my personal app engine project ("gcloud app deploy", that's app engine, I think), and with 1.19 specified in go.mod and "runtime: 119" in app.yaml, the app reported runtime.Version() of 1.19.3. My understanding is this is a recent change. On Thursday, December 15, 2022 at

[go-nuts] Re: Context cancellation: Is it sufficient to make long-running things interruptible?

2022-12-19 Thread Brian Candler
It depends entirely on your application, and how the various goroutines are wired together with channels. But as a guiding principle: I'd say that anything which *sends* on a channel should close it when it's finished - whether that be due to context cancellation, or some other reason.

[go-nuts] Re: Context cancellation: Is it sufficient to make long-running things interruptible?

2022-12-19 Thread Torsten Bronger
Hallöchen! Brian Candler writes: > On Monday, 19 December 2022 at 12:01:39 UTC Torsten Bronger wrote: > >> But would you agree that additional checking is necessary if >> DoSomething does not have a ctx argument? > > Given that you're running DoSomething synchronously, it will always > run to

[go-nuts] Re: Context cancellation: Is it sufficient to make long-running things interruptible?

2022-12-19 Thread Brian Candler
On Monday, 19 December 2022 at 12:01:39 UTC Torsten Bronger wrote: > But would you agree that additional checking is necessary if > DoSomething does not have a ctx argument? > Given that you're running DoSomething synchronously, it will always run to completion. So you'll always have a valid

[go-nuts] Re: Context cancellation: Is it sufficient to make long-running things interruptible?

2022-12-19 Thread Torsten Bronger
Hallöchen! Jan Mercl writes: > [...] > > From https://go.dev/ref/spec#Select_statements > > > 2. If one or more of the communications can proceed, a single one that > can proceed is chosen via a uniform pseudo-random selection. > > > Selecting the send case in the above code, when both

[go-nuts] Re: Context cancellation: Is it sufficient to make long-running things interruptible?

2022-12-19 Thread Torsten Bronger
Hallöchen! Harris, Andrew writes: > The precise ordering of things is a bit non-deterministic at the > fringe. If precise ordering really matters (maybe for cancelling a > stream like this, it doesn’t, sometimes it does), a default case in > the select statement is really useful, and it also

Re: [go-nuts] Context cancellation: Is it sufficient to make long-running things interruptible?

2022-12-19 Thread Harris, Andrew
The precise ordering of things is a bit non-deterministic at the fringe. If precise ordering really matters (maybe for cancelling a stream like this, it doesn’t, sometimes it does), a default case in the select statement is really useful, and it also matters what DoSomething does.

[go-nuts] Re: Context cancellation: Is it sufficient to make long-running things interruptible?

2022-12-19 Thread Brian Candler
On Monday, 19 December 2022 at 10:01:41 UTC Torsten Bronger wrote: > I would additionally check for ctx.Err() != nil somewhere in the > loop. Or is there a reason why this is not necessary? > See https://pkg.go.dev/context#Context // If Done is not yet closed, Err returns nil. // If

Re: [go-nuts] Context cancellation: Is it sufficient to make long-running things interruptible?

2022-12-19 Thread Jan Mercl
On Mon, Dec 19, 2022 at 11:01 AM Torsten Bronger wrote: > The context documentation gives this example: > > // Stream generates values with DoSomething and sends them to out > // until DoSomething returns an error or ctx.Done is closed. > func Stream(ctx context.Context, out chan<-

[go-nuts] Context cancellation: Is it sufficient to make long-running things interruptible?

2022-12-19 Thread Torsten Bronger
Hallöchen! The context documentation gives this example: // Stream generates values with DoSomething and sends them to out // until DoSomething returns an error or ctx.Done is closed. func Stream(ctx context.Context, out chan<- Value) error { for { v, err :=