Re: [go-nuts] Re: [ generics] Moving forward with the generics design draft

2020-08-23 Thread roger peppe
On Mon, 24 Aug 2020 at 06:35, Denis Cheremisov wrote: > I probably didn't read what you have wrote in the first message carefuly > enough. Does it mean something like that will work > > type SomeTypes interface { > type int, float32, float64 > } > > func Min[T SomeTypes](x, y T) T

Re: [go-nuts] Re: [ generics] Moving forward with the generics design draft

2020-08-23 Thread Denis Cheremisov
I probably didn't read what you have wrote in the first message carefuly enough. Does it mean something like that will work type SomeTypes interface { type int, float32, float64 } func Min[T SomeTypes](x, y T) T { switch T { case int: if x < y {

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2020-08-23 Thread alex . besogonov
Can we at least move with the https://github.com/golang/go/issues/22729 , please? Anything will help with the current mess. On Sunday, August 23, 2020 at 8:52:30 PM UTC-7, Ian Lance Taylor wrote: > > On Sun, Aug 23, 2020 at 1:16 PM Denis Cheremisov > > wrote: > > > > You may use something like

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2020-08-23 Thread Ian Lance Taylor
On Sun, Aug 23, 2020 at 1:16 PM Denis Cheremisov wrote: > > You may use something like this > > value2 := *(*uint64)(unsafe.Pointer(uintptr(unsafe.Pointer(&value)) + > 8)) > if value2 == 0 { > return true > } > > on AMD64, should work also for any 64 bit ar

Re: [go-nuts] Re: [ generics] Moving forward with the generics design draft

2020-08-23 Thread Ian Lance Taylor
On Sun, Aug 23, 2020 at 3:00 PM Juliusz Chroboczek wrote: > > > We’re going to permit type switches on type parameters that have type > > lists, without the “.(type)” syntax. The “(.type)” syntax exists to > > clarify code like “switch v := x.(type)”. > > Could you please give an example of the p

[go-nuts] Re: [ generics] Moving forward with the generics design draft

2020-08-23 Thread Juliusz Chroboczek
> We’re going to permit type switches on type parameters that have type > lists, without the “.(type)” syntax. The “(.type)” syntax exists to > clarify code like “switch v := x.(type)”. Could you please give an example of the proposed syntax? -- You received this message because you are subscri

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2020-08-23 Thread Denis Cheremisov
You may use something like this *value2 := *(*uint64)(unsafe.Pointer(uintptr(unsafe.Pointer(&value)) + 8))* *if value2 == 0 {* *return true* *}* on AMD64, should work also for any 64 bit architecture (at least I believe so). Remember though this is hacky

Re: [go-nuts] Re: How to know if interface{} data is nil w/o reflecting?

2020-08-23 Thread Aviv Eyal
I was trying to show that the current behavior is confusing and that fmt.Print() needing to resort to panic-and-recover is kinda code smell, but I sorts-of convinced myself that the current behavior is right, or at least consistent. In my code, I got bit because I sometimes use v *Type to denot

[go-nuts] Is this behavior by textproto.Writer.DotWriter correct?

2020-08-23 Thread Jonathan
When a DotWriter is created and closed without any write being done, the buffer contains a CR/LF . CR/LF. When a DotWriter is created and closed with a single write of an empty line, the buffer also contains CR/LF . CR/LF. See: https://play.golang.org/p/ScXaRPBH7vI This seems wrong to me. If i

Re: [go-nuts] Mysterious RSS memory spike

2020-08-23 Thread Mike Spreitzer
BTW, how are you measuring RSS? That is a trick all by itself! See https://groups.google.com/g/golang-nuts/c/LsOYrYc_Occ/m/LbjLAsL6BwAJ Regards, Mike golang-nuts@googlegroups.com wrote on 08/23/2020 11:04:47 AM: > From: Manish R Jain > To: "golang-nuts" > Date: 08/23/2020 11:04 AM > Subject

Re: [go-nuts] Re: basics of understanding golang memory usage

2020-08-23 Thread Mike Spreitzer
BTW, how are you measuring RSS? That is a trick in and of itself! https://groups.google.com/g/golang-nuts/c/LsOYrYc_Occ/m/LbjLAsL6BwAJ Regards, Mike golang-nuts@googlegroups.com wrote on 08/18/2020 01:56:30 AM: > From: Mike Spreitzer > To: golang-nuts > Date: 08/18/2020 01:56 AM > Subject: [

RE: [go-nuts] Debug http calls made using go http client

2020-08-23 Thread Mike Spreitzer
Krishna can put a use of TCPMon or tcpdump inside the Kubernetes Pod. Either of these things can be added to the main container, or put in another container in the Pod. Regards, Mike golang-nuts@googlegroups.com wrote on 08/23/2020 01:06:20 PM: > From: "Tamás Gulácsi" > To: golang-nuts > Dat

Re: [go-nuts] how golang choose instructions?

2020-08-23 Thread Ian Lance Taylor
On Sat, Aug 22, 2020 at 10:31 PM xie cui wrote: > > we can find same dynamic programming algorithm(like BURS bottom rewriting > system), to choose instructions in book about compiler technique. but as far > as i know, it seems that golang just transform ast to ssa IR, then lower to > machine in

Re: [go-nuts] Debug http calls made using go http client

2020-08-23 Thread Tamás Gulácsi
You can print every step with net/http/httptrace 's ClientTrace. krishna...@gmail.com a következőt írta (2020. augusztus 23., vasárnap, 15:55:50 UTC+2): > Hello Dimas, > > Thank you for your response. My application is running in a kubernetes > cluster and I will not be able to run TCPMon or TC

[go-nuts] Mysterious RSS memory spike

2020-08-23 Thread Manish R Jain
Hey Gophers, I'm puzzled by a mysterious RSS memory spike in my Go program, when all memory allocations are happening via Cgo. I assert that there are no memory leaks in the program. And have written another C program with similar logic which does NOT show RSS memory spiking. So, I suspect thi

Re: [go-nuts] Debug http calls made using go http client

2020-08-23 Thread Krishna Kowshik
Hello Dimas, Thank you for your response. My application is running in a kubernetes cluster and I will not be able to run TCPMon or TCPDump separately, as access is restricted. I was looking for something that can be embedded within the go application. Regards, *Krishna* On Sun, Aug 23, 2020 a

Re: [go-nuts] Debug http calls made using go http client

2020-08-23 Thread Dimas Prawira
There are several tools which you can use to help to inspect, 1. TCPmon, is a java-based tool for inspecting http call in between server and client. TCPmon also can be used to simulate slow connection. Work mechanism of TCPmon is as a proxy. So if I describe it as below [Your apps] ---> [tcpmon]

[go-nuts] Re: [modules] List available only patch upgrades

2020-08-23 Thread Jérôme LAFORGE
Hello, I have just created this issue: https://github.com/golang/go/issues/40990 Regards, Jérôme Le vendredi 14 août 2020 19:21:20 UTC+2, Jérôme LAFORGE a écrit : > > Hello Gophers, > > I want to list modules available only for available only patch upgrades. > The given example here > https://gi