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

2022-04-14 Thread Zhaoxun Yan
Something bizarre happened in CGO. My new code started the anonymous goroutine to receive first but it does not sleep below the goroutine and jumps to end the function. So I returned to the sending before receiving way, which guaranteed the program's safety. There ain't always one way that fits

Re: [go-nuts] [gofrontend] Generics support?

2022-04-14 Thread Lanzhiguan Huang
Thanks! On Friday, April 15, 2022 at 2:29:11 AM UTC+8 Ian Lance Taylor wrote: > On Thu, Apr 14, 2022 at 3:51 AM Lanzhiguan Huang > wrote: > > > > Just curious about will the gofrontend support generics or it is already > supported? > > I'm working on it, but it's going slowly. > > Ian > --

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

2022-04-14 Thread 'Dan Kortschak' via golang-nuts
On Thu, 2022-04-14 at 03:05 -0700, Michel Casabianca wrote: > Any comment and contribution welcome. Can I suggest that you use golang.org/x/sys/execabs rather than os/exec in ExecCommand? -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To

Re: [go-nuts] encoding/json mistakenly transfer int64 format to string

2022-04-14 Thread Brian Candler
"txtar " is the magic. In the playground, there's a dropdown on the right - it says "Hello, World!" by default. From here, you can select the example called "Multiple Files". On Thursday, 14 April 2022 at 17:50:14 UTC+1 michael...@gmail.com wrote:

Re: [go-nuts] [gofrontend] Generics support?

2022-04-14 Thread Matthew Singletary
Thanks Ian! On Thu, Apr 14, 2022 at 2:29 PM Ian Lance Taylor wrote: > On Thu, Apr 14, 2022 at 3:51 AM Lanzhiguan Huang > wrote: > > > > Just curious about will the gofrontend support generics or it is > already supported? > > I'm working on it, but it's going slowly. > > Ian > > -- > You

Re: [go-nuts] [gofrontend] Generics support?

2022-04-14 Thread Ian Lance Taylor
On Thu, Apr 14, 2022 at 3:51 AM Lanzhiguan Huang wrote: > > Just curious about will the gofrontend support generics or it is already > supported? I'm working on it, but it's going slowly. Ian -- You received this message because you are subscribed to the Google Groups "golang-nuts"

[go-nuts] Got unknown stack while capturing go binary exit point with bpftrace

2022-04-14 Thread Yeqowcc
Hi there, I want to practice *bpftrace* tracing go program exit point, such as, *runtime.gopanic* and *os.Exit*, but I'm confused with the result (there's different stack information between* runtime.panic* and *syscall.Exit/os.Exit*): [root@localhost trace-go-func]# bpftrace -c "./binary

[go-nuts] Tool to check binaries for vulnerabilities

2022-04-14 Thread Michel Casabianca
Hello Gophers, We, at Intercloud, have developed a tool to check dependencies embedded in Go binaries. It first lists dependencies running "go version -m mybinary", then it looks for vulnerabilities in NVD online database (at https://nvd.nist.gov/). This tool is open source and available at

Re: [go-nuts] encoding/json mistakenly transfer int64 format to string

2022-04-14 Thread Michael Ellis
@Brian That example is a superbly concise explanation go mod. Thanks! And I had no idea you could specify filenames and modules in the Playground. That's really useful! On Wednesday, April 13, 2022 at 3:11:54 AM UTC-4 Brian Candler wrote: > > I am a little bewildered by the new mod

Re: [go-nuts] errors (langChange)

2022-04-14 Thread Matthias Mädel
following simulates some functionality package main import ( "fmt" "io" "log" "os" ) func GOTO(f *os.File, e error) (*os.File, error) { return f, e } func COPYGOTO(i int64, e error) (int64, error) { return i, e } var err error var r, w *os.File func main() {

[go-nuts] Is it possible to define a generic/inherited method?

2022-04-14 Thread mi...@ubo.ro
I have a function that encodes Go data structure in a certain way. Below is a an example // Data structure type DataX struct{ X string `query:"x"` } func MarshalJSON(v interface)([]byte, error){ s := query.Encode(v) return s.Bytes(), nil } Currently in order to force the json encoder

Re: [go-nuts] Re: No downloadable go1.18.1 version for darwin

2022-04-14 Thread Steven Hartland
Looks like this is fixed now. On Wed, 13 Apr 2022 at 15:48, Brian Candler wrote: > It's mentioned in the original announcement > : > > "macOS binary artifacts for Go 1.18.1 are not available at this time due > to an issue

[go-nuts] [gofrontend] Generics support?

2022-04-14 Thread Lanzhiguan Huang
Hi, Just curious about will the gofrontend support generics or it is already supported? -- 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

Re: [go-nuts] errors (langChange)

2022-04-14 Thread Matthias Mädel
some refining... func Experimental(src, dst string) error { //goto jumps to "label" if present; selects values right to left; is ignored with value´s zero value goto r, err := os.Open(src) defer r.Close() goto w, err := os.Create(dst) defer w.Close() goto v, err :=

[go-nuts] generics: parametric types unmarshaling

2022-04-14 Thread 'Sebastien Binet' via golang-nuts
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 struct { v string } func (t *T1) UnmarshalBinary(p []byte) error { t.v = string(p) return

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

2022-04-14 Thread Brian Candler
The fact that the sender may have to wait does not by itself make a "deadlock". It's a deadlock if the sender blocks and, due to poor programming, the receiver is *never* ready to receive. That's a problem with your software, not with Go's concept of channels. Blocking on send until the