Re: [go-nuts] Conditional compilation in Go ?

2024-08-18 Thread Nagaev Boris
Hi! Regarding 2 yes, conditional compilation is done on file level, via build tags. There are built-in tags for OS and CPU architectures. You can read here about it: https://pkg.go.dev/cmd/go#hdr-Build_constraints Boris On Sun, Aug 18, 2024 at 4:06 PM alex-coder wrote: > > Hi All ! Please advic

Re: [go-nuts] generics question

2024-04-22 Thread Nagaev Boris
On Mon, Apr 22, 2024 at 9:54 PM Ian Lance Taylor wrote: > > On Mon, Apr 22, 2024 at 2:25 PM Jochen Voss wrote: > > > > Using generics, can I somehow write a constraint which says that *T > > (instead of T) implements a certain interface? The following code > > illustrated what I'm trying to do

Re: [go-nuts] Is json.Marshal deterministic?

2024-04-09 Thread Nagaev Boris
Hi Juliusz, I don't know if JSON serialization is deterministic, but I know a couple of cases when it is not. If the type or some type inside it has a custom JSON marshaller (method MarshalJSON), then if that function's output is not deterministic, the whole JSON for the type is not deterministic

[go-nuts] [ANN] Go package for determining crawler User Agents

2024-04-05 Thread Nagaev Boris
Hey folks, Repo https://github.com/monperrus/crawler-user-agents contains an updated list of patterns of HTTP user-agents used by robots, crawlers, and spiders as in a single JSON file. It recently got updated, now it's a Go package! The package uses go:embed to access crawler-user-agents.json fi

Re: [go-nuts] Re: help with thread limit

2024-02-01 Thread Nagaev Boris
Steve, I checked with strace and top -p (press H to see threads). It seems that Go can create few more threads than cores are given by taskset. For example, on an 8 core ARM machine in the cloud, I got these results on a program launching 100 goroutines utilizing a lot of CPU each. $ strace --f

Re: [go-nuts] Re: Any option to substitute plug-in package ?

2023-10-29 Thread Nagaev Boris
For highly-specific filtering, you might also find https://github.com/google/cel-go interesting. CEL is statically typed and declarative. On Sat, Oct 28, 2023 at 11:48 PM Mike Schinkel wrote: > > I recently started using github.com/yuin/gopher-lua for a project to allow > users to add filtering

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

2023-09-26 Thread 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 Nagaev Boris wrote: > Hi again :-) > > I addressed feedback in CL > https://go-review.googlesource.com/c

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

2023-09-10 Thread Nagaev Boris
Hi again :-) I addressed feedback in CL https://go-review.googlesource.com/c/go/+/413594 Generators of ASM are now written in Go using template/text instead of Python. Also added tests Please review! On Sun, Aug 7, 2022 at 11:59 AM Boris Nagaev wrote: > > Hi everyone! > > I sent CL https://go-re

Re: [go-nuts] Cannot set http 413 status from http.MaxBytesReader

2023-08-29 Thread Nagaev Boris
On Tue, Aug 29, 2023 at 5:44 PM Rory Campbell-Lange wrote: > > I've made an http middleware that uses http.MaxBytesReader to limit the > accepted size of requests. > > The middleware is as follows: > > func bodyLimitMiddleware(next http.Handler) http.Handler { > return http.HandlerFun

Re: [go-nuts] Bets approach for test helper packages within same project

2023-08-04 Thread Nagaev Boris
Hi, You can put test helpers to a separate package (directory), say testhelper/ without a build tag. Code in that directory will use regular code and it will have its own unit tests in testhelper/ directory. When you build your production binary, it won't include such code, because it is not impor