[go-nuts] Clearing sessions

2021-10-13 Thread Денис Мухортов
Hi, there! How to properly clean up sessions after before disconnecting the server or before starting it? have a problem that the server is on a free hosting that periodically shuts down the server. Since cookies are stored with me and they are no longer relevant, my server is panicking. This

Re: [go-nuts] testing if strconv.Quote() would do change a string, without calling it

2021-10-13 Thread 'Tim Hockin' via golang-nuts
Thanks for confirming. I wrote that function and erased a good bit of the overhead. bytes.Buffer for the no-escapes path and strconv.Quote otherwise. On Wed, Oct 13, 2021, 8:49 PM Ian Lance Taylor wrote: > On Wed, Oct 13, 2021 at 3:46 PM 'Tim Hockin' via golang-nuts > wrote: > > > > Is

Re: [go-nuts] testing if strconv.Quote() would do change a string, without calling it

2021-10-13 Thread Ian Lance Taylor
On Wed, Oct 13, 2021 at 3:46 PM 'Tim Hockin' via golang-nuts wrote: > > Is there any ready-built function that can tell me whether `strconv.Quote()` > would produce a different string than its input, without actually running it? > Or is there a clearly documented set of rules one could use to

Re: [go-nuts] testing if strconv.Quote() would do change a string, without calling it

2021-10-13 Thread 'Tim Hockin' via golang-nuts
If I find a string with a stray backslash in it (which passes IsPrint()) I still need to quote. I dug into the Quote() impl and this seems like the right path. Thanks! On Wed, Oct 13, 2021 at 4:31 PM Robert Engels wrote: > I was thinking the other way. If !IsPrint() then strconv.Quote() > >

Re: [go-nuts] testing if strconv.Quote() would do change a string, without calling it

2021-10-13 Thread Robert Engels
I was thinking the other way. If !IsPrint() then strconv.Quote() > On Oct 13, 2021, at 6:24 PM, Tim Hockin wrote: > >  > ` IsPrint(r) || r == '\\' || r == '"' ` passes tests. I need to build > confidence in that, though :) Thanks. > >> On Wed, Oct 13, 2021 at 4:16 PM Robert Engels wrote:

Re: [go-nuts] testing if strconv.Quote() would do change a string, without calling it

2021-10-13 Thread 'Tim Hockin' via golang-nuts
` IsPrint(r) || r == '\\' || r == '"' ` passes tests. I need to build confidence in that, though :) Thanks. On Wed, Oct 13, 2021 at 4:16 PM Robert Engels wrote: > A simple loop calling IsPrint is your best bet. You could then have a > custom implementation of Quote that started at a specified

Re: [go-nuts] testing if strconv.Quote() would do change a string, without calling it

2021-10-13 Thread Robert Engels
A simple loop calling IsPrint is your best bet. You could then have a custom implementation of Quote that started at a specified index. > On Oct 13, 2021, at 5:46 PM, 'Tim Hockin' via golang-nuts > wrote: > > Is there any ready-built function that can tell me whether `strconv.Quote()` >

[go-nuts] testing if strconv.Quote() would do change a string, without calling it

2021-10-13 Thread 'Tim Hockin' via golang-nuts
Is there any ready-built function that can tell me whether `strconv.Quote()` would produce a different string than its input, without actually running it? Or is there a clearly documented set of rules one could use to test each rune in a string? I am trying to avoid allocations, and MOST of

[go-nuts] Fresh gotip amd64 releases for experimental CI fuzzing or lang dev without compiling

2021-10-13 Thread Filip Dimitrovski
Hi, I did a GitHub repo that offers gotips without compiling. I wanted to use the Go fuzzing feature that's now merged on master in a CI job for detecting bugs, but compiling go every time was slow, and caching meant the build would get too stale. I've released it here:

Re: [go-nuts] Will the generics support be enabled by default in Go 1.18?

2021-10-13 Thread 'Axel Wagner' via golang-nuts
On Wed, Oct 13, 2021 at 11:36 AM roger peppe wrote: > ISTM that in a sense, generics *are* behind a flag in 1.18, on a > per-module basis at any rate - if your go.mod file doesn't declare a Go > version of at least 1.18, then you can't use type parameters. > The (important) difference being

Re: [go-nuts] Will the generics support be enabled by default in Go 1.18?

2021-10-13 Thread roger peppe
On Tue, 12 Oct 2021 at 01:42, Ian Lance Taylor wrote: > On Mon, Oct 11, 2021 at 2:36 AM peter.m...@gmail.com > wrote: > > > > I'm curious, was any consideration given to hiding generics behind a > flag in 1.18? The idea being it's such a complex feature that one could > imagine a backwards