[go-nuts] Go 1.18: reflect implicit type conversion

2022-04-15 Thread Dave Keck
Hi all, In this code, the SetMapIndex line panics in Go <1.18, but it no longer panics in Go 1.18: type CustomString string m := reflect.ValueOf(map[CustomString]int{}) m.SetMapIndex(reflect.ValueOf("key"), reflect.ValueOf(0)) The panic ("value of type string is not assignable to typ

Re: [go-nuts] Loop unit char entered

2022-04-15 Thread Kurtis Rader
On Fri, Apr 15, 2022 at 6:35 AM Daniel Jankins wrote: > I have a newbie question. I want to loop until a char is available > (keypress). > Could someone point me to an example. > I can't point you to an example because that wouldn't be idiomatic Go; thus such examples are (I hope) hard to find.

[go-nuts] MatrixOne: a hyperconverged and one-size-fits-most database in Go

2022-04-15 Thread Nan DENG
Hi, I’d like to introduce a hyperconverged and one-size-fits-most database named MatrixOne, written in Go. Github: https://github.com/matrixorigin/matrixone It’s a redesigned database with a combined architecture of CockroachDB, Clickhouse and Apache Flink. Our motivation is to bring a sim

[go-nuts] Loop unit char entered

2022-04-15 Thread Daniel Jankins
Hi All, I have a newbie question. I want to loop until a char is available (keypress). Could someone point me to an example. Thank you -- DanJ -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving e

Re: [go-nuts] generics: parametric types unmarshaling

2022-04-15 Thread 'Sebastien Binet' via golang-nuts
On Fri Apr 15, 2022 at 10:52 CET, roger peppe wrote: > > what am I missing? > > how do I convey the constraint "unmarshaling usually imply passing a > > pointer to some value" ? > > > > This is a classic use case for structural type constraints: > https://go.dev/play/p/-stEjeeqQD0 thanks a lot! a

Re: [go-nuts] Tool to check binaries for vulnerabilities

2022-04-15 Thread 'Sean Liao' via golang-nuts
If you only need to target 1.18+, you can use `debug/buildinfo.ReadFile` which doesn't require shelling out to go On Fri, Apr 15, 2022 at 7:03 AM Zhaoxun Yan wrote: > That sounds great! Thanks. > > 在2022年4月15日星期五 UTC+8 05:55:27 写道: > >> On Thu, 2022-04-14 at 03:05 -0700, Michel Casabianca wrote

Re: [go-nuts] generics: parametric types unmarshaling

2022-04-15 Thread roger peppe
On Thu, 14 Apr 2022, 09:50 'Sebastien Binet' via golang-nuts, < golang-nuts@googlegroups.com> wrote: > hi there, > > I am playing a bit with generics. > I am trying to implement a parametrized "Read" function that unmarshals > bytes into some type value that implements an interface: > > type T1 st

Re: [go-nuts] Re: generics: parametric types unmarshaling

2022-04-15 Thread 'Sebastien Binet' via golang-nuts
hi, On Fri Apr 15, 2022 at 08:00 CET, Zhaoxun Yan wrote: > Here is my note on json & struct, run it somewhere and it may give you a > hint. > > package main > > import "fmt" > import "encoding/json" > > type prices struct{ > Price float64 `json:"price"` > floor float64 > Ceiling float64 > settle f

Re: [go-nuts] Re: Protective buffered channel that never triggers deadlock

2022-04-15 Thread Brian Candler
On Friday, 15 April 2022 at 08:31:17 UTC+1 yan.z...@gmail.com wrote: > Thanks for your demonstration, Brian. > Actually my code involving cgo is quite like your first case, like this > code: > > *log("start testing")* > *go func{* > * for* > * select* > * case a: <=receiving* > *

Re: [go-nuts] Re: Protective buffered channel that never triggers deadlock

2022-04-15 Thread Zhaoxun Yan
Thanks for your demonstration, Brian. Actually my code involving cgo is quite like your first case, like this code: *log("start testing")* *go func{* * for* * select* * case a: <=receiving* * case <- killsig* *...* *}()* *subscribequotations* *( meanwhile the cgo of the dll will c

Re: [go-nuts] Re: Protective buffered channel that never triggers deadlock

2022-04-15 Thread Brian Candler
On Friday, 15 April 2022 at 06:47:09 UTC+1 yan.z...@gmail.com wrote: > When one server finds something wrong, it sends out a request to another > server for help. > Then it makes a log and then a ticker to recheck the situation again and > again and in the meantime, to receive a response from th