Re: [go-nuts] How does Go runtime decide minimum number of threads?

2022-06-20 Thread TheDiveO
additionally, threads (m's) currently locked to goroutines using runtime.LockOSThread don't count either. On Tuesday, June 21, 2022 at 2:38:04 AM UTC+2 se...@liao.dev wrote: > from runtime: > > > The GOMAXPROCS variable limits the number of operating system threads > that can execute user-leve

[go-nuts] Re: Go allocator: allocates arenas, reclaims pages?

2022-06-20 Thread 'Michael Knyszek' via golang-nuts
Just to clarify, when I said "publicly visible" I meant via blog posts and talks. There are a few design documents

Re: [go-nuts] How does Go runtime decide minimum number of threads?

2022-06-20 Thread 'Sean Liao' via golang-nuts
from runtime: > The GOMAXPROCS variable limits the number of operating system threads that can execute user-level Go code simultaneously. There is no limit to the number of threads that can be blocked in system calls on behalf of Go code; those do not count against the GOMAXPROCS limit. - sean O

[go-nuts] find hwnd on win 10

2022-06-20 Thread Robert Solomon
Hi. I'm struggling to get this code to return a non-zero hwnd. I'm compiling w/ Go 1.18.3 Any help would be most appreciated. package main import ( "fmt" w32a "github.com/JamesHovious/w32" w32 "github.com/gonutz/w32/v2" "runtime" const lastModified = "June 20, 2022" func main() {

[go-nuts] How does Go runtime decide minimum number of threads?

2022-06-20 Thread Rahul Tiwari
I have intentionally set a max limit on the number of threads which can be spawned by my Go program to be 1 and the Go runtime errors out that it exceeds 1-thread limit. I've checked the entire code of runtime but couldn't find how the minimum threshold of threads to be spawned is decided. Any p

[go-nuts] Generic interface compiles with incorrectly instantiated types

2022-06-20 Thread Tsvi Benschar
Hey everyone, reposting a question I asked on the go forum since it isn't getting replies there. I have some code that’s compiling and running despite there being a type error. I don’t under

[go-nuts] Built-in benchmark tracking and regression failures

2022-06-20 Thread Will Faught
I'm wondering if it would be useful to build benchmark regression detection into Go test benchmarks, and policy enforcement in terms of making regressions fail a benchmark "test". If I understand correctly, as Go benchmarks currently stand, they tell you the numbers, but it's left to you to interp

[go-nuts] Re: Go allocator: allocates arenas, reclaims pages?

2022-06-20 Thread 'Michael Knyszek' via golang-nuts
Thanks for the question. The scavenger isn't as publicly visible as other parts of the runtime. You've got it mostly right, but I'm going to repeat some things you've already said to make it clear what's different. The Go runtime maps new heap memory (specifically: a new virtual memory mapping

Re: Private message regarding: [go-nuts] How to return concrete implementation to satisfy interface

2022-06-20 Thread Brian Candler
If you're new to Go, beware of one thing when returning interface values which are implemented by pointers. An interface value can be nil (i.e. the zero value of interface: no type and no value); or it can contain a concrete value a concrete pointer type - where the concrete value itself is ni

Re: Private message regarding: [go-nuts] How to return concrete implementation to satisfy interface

2022-06-20 Thread 'Axel Wagner' via golang-nuts
[+golang-nuts again. Please don't respond off-list, so anyone can benefit from the discussion] On Mon, Jun 20, 2022 at 8:32 PM Deividas Petraitis wrote: > Thank you for reply, it was really helpful! I wish groups would allow to > edit the title. > According to he FAQ it seems like there should b

Re: [go-nuts] slack

2022-06-20 Thread Ian Lance Taylor
On Mon, Jun 20, 2022 at 10:43 AM Rango wrote: > > how can i join the golang slack channel? According to the wiki you can go to https://invite.slack.golangbridge.org/ (but I haven't tried it recently). Ian -- You received this message because you are subscribed to the Google Groups "golang-nut

[go-nuts] slack

2022-06-20 Thread Rango
how can i join the golang slack channel? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the

[go-nuts] Go allocator: allocates arenas, reclaims pages?

2022-06-20 Thread Vitaly Isaev
Go allocator requests memory from OS in large arenas (on Linux x86_64 the size of arena is 64Mb), then allocator splits each arena to 8 Kb pages, than merges pages in spans of different sizes (from 8kb to 80kb size according to https://go.dev/src/runtime/sizeclasses.go). This process is well de

[go-nuts] Re: generics compile error: struct does not match interface, cannot infer type

2022-06-20 Thread Brian Candler
In that case, the 'T' is whatever the type argument is to the generic "run" function. So as long as "run" can infer its argument type, then you're all good. That's the "easy" case for type inference: an argument of type T. func run[T any](t T) You call run with a string literal, so clearl

[go-nuts] Re: generics compile error: struct does not match interface, cannot infer type

2022-06-20 Thread Mike Andrews
here's an example more like my specific use case that i just mentioned, with the surprising inference behavior --- https://go.dev/play/p/BNmjlYejawZ On Monday, June 20, 2022 at 9:21:34 AM UTC-4 Mike Andrews wrote: > great, thanks brian, works like a charm. surprisingly, even works in my > speci

[go-nuts] Re: generics compile error: struct does not match interface, cannot infer type

2022-06-20 Thread Mike Andrews
great, thanks brian, works like a charm. surprisingly, even works in my specific use case calling it like "interfaceFunc[T](x)" generically without being specific like "[string]", wondering why the compiler's inference is like that? is it a flaw or just a limitation of the concept per se? On Mo

[go-nuts] Re: generics compile error: struct does not match interface, cannot infer type

2022-06-20 Thread Brian Candler
Type inference doesn't work in all cases. When required, just be explicit: interfaceFunc[string](x) https://go.dev/play/p/j66sXsfMUBl On Monday, 20 June 2022 at 13:06:57 UTC+1 Mike Andrews wrote: > anyone know why this simple case doesn't compile? i'm trying to call a > function defin

[go-nuts] generics compile error: struct does not match interface, cannot infer type

2022-06-20 Thread Mike Andrews
anyone know why this simple case doesn't compile? i'm trying to call a function defined for generic interface type, which fails to compile for struct instance: https://go.dev/play/p/Y3Gdr2ILpK4 -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

[go-nuts] Re: Can't read >32KBytes from http response body.

2022-06-20 Thread Brian Candler
1. What's the web server you're connecting to? (Is it written in go, and if so, can you share it?) 2. What happens if you use io.Read instead of io.ReadAtLeast? 3. What happens if you remove the time.Sleep()? (Maybe the target webserver has a timeout which requires the transaction to be complete