Re: [go-nuts] Re: Virtual time for testing

2021-01-31 Thread Christian Worm Mortensen
I ended up creating an issue on this: https://github.com/golang/go/issues/44026 On Sat, Jan 30, 2021 at 9:12 PM Christian Worm Mortensen wrote: > Hi Mike, > > Thank you for your consideration. I think you exactly got the essence of > my question: How do I wait on all go routines to finish (or

Re: [go-nuts] Re: Gidelines or best practices on error on error handling?

2021-01-31 Thread Jan Mercl
On Sun, Jan 31, 2021 at 8:04 AM Amnon wrote: > I really do not like code like > defer func() { > if cerr := f.Close(); cerr != nil && err == nil { > err = cerr > } > }() .. > If somebody later > changes the function to return unnamed values, this defer will silently fail. The def

[go-nuts] If the go program compiled by a completely static compiled version of go binary compiler will also be static automatically?

2021-01-31 Thread Hongyi Zhao
If the go program compiled by a completely static compiled version of go binary compiler will also be static automatically? To be more specific, on Ubuntu 20.04, I've compiled the latest git master version of go compiler in a completely static manner as shown below: $ which go | xargs file /hom

[go-nuts] normal mode and starve mode of sync.Mutex and runtime mutex?

2021-01-31 Thread xie cui
why mutex in runtime do not need starve mode? -- 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

Re: [go-nuts] Re: Gidelines or best practices on error on error handling?

2021-01-31 Thread Amnon
*The deferred function literal refers to a named return variable.Changing it to an unnamed one will cause the program to no longercompile.* Interesting https://play.golang.org/p/jnRn4Bv98xS See the example on the Go Playground. Jan, someone can explain to me why it will no longer compile

[go-nuts] Re: normal mode and starve mode of sync.Mutex and runtime mutex?

2021-01-31 Thread jake...@gmail.com
What makes you think it does not? Have you looked at Mutex.lockSlow()? I have not really worked through the algorithm, but the comments do mention starvation mode. On Sunday, January 31, 2021 at 10:15:23 AM UTC-5 cuiw...@gmail.com wrote: > why mutex in runtime do not need starve mode? -- You

Re: [go-nuts] Re: Gidelines or best practices on error on error handling?

2021-01-31 Thread Jan Mercl
On Sun, Jan 31, 2021 at 5:24 PM Amnon wrote: > https://play.golang.org/p/jnRn4Bv98xS > > See the example on the Go Playground. > > Jan, someone can explain to me why it will no longer compile? That's not an example of what I wrote: "Changing it to an unnamed one will cause the program to no long

Re: [go-nuts] Re: Gidelines or best practices on error on error handling?

2021-01-31 Thread Amnon
OK. If you take the https://play.golang.org/p/L8z2Q_F_fi3 and change the line 18 from func foo() (err error) { to func foo() error { The code will continue to compile. But it will stop working (i.e. the error from f.Close will not be returned by foo). Unfortunately this is not a contrived

Re: [go-nuts] Re: Gidelines or best practices on error on error handling?

2021-01-31 Thread Jan Mercl
On Sun, Jan 31, 2021 at 6:01 PM Amnon wrote: > If you take the > https://play.golang.org/p/L8z2Q_F_fi3 > > and change the line 18 > from > func foo() (err error) { > > to > func foo() error { > > The code will continue to compile. That's again the case of "making the return variable unnamed and d

[go-nuts] where is the g writebuf flushed?

2021-01-31 Thread arthurwil...@gmail.com
in runtime/print.go gwrite, if the data is put in the gp.writebuf where does that writebuf get flushed? -- 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-nu

Re: [go-nuts] Using go tool with third-party Go implementations

2021-01-31 Thread Alexander Zhirov
Thanks to Ian's pointers I was able to get to a state where "go build" command passes successfully. For the moment my compile/link/asm stubs produce minimally viable outputs (which are mostly empty), but the go tool is happy enough with the contents. Next step of plugging GopherJS logic in should n

Re: [go-nuts] sycall/js : does it require build tags? if so whihc ones?

2021-01-31 Thread at diar
Thanks. I think I figured it out. Apart from the build tags that you have mentioned, depending on the code editor, the build tool need to be specified GOOS and GOARCH too. And some of the old code completion tools do not support the new syscall/js package. In my case, using atom.io, I had to laun

[go-nuts] Re: normal mode and starve mode of sync.Mutex and runtime mutex?

2021-01-31 Thread xie cui
mutex in sync package and runtime is different, mutex in runtime package is here, https://github.com/golang/go/blob/master/src/runtime/lock_futex.go#L46 i do not see there is a starving mode. On Monday, February 1, 2021 at 12:38:08 AM UTC+8 jake...@gmail.com wrote: > What makes you think it does

Re: [go-nuts] normal mode and starve mode of sync.Mutex and runtime mutex?

2021-01-31 Thread robert engels
Not sure the runtime needs it - as all lock usages are known - so the users in the runtime can ’negotiate’ fairness through other means for a particular mutex. > On Jan 31, 2021, at 8:56 PM, xie cui wrote: > > mutex in sync package and runtime is different, > mutex in runtime package is here,

[go-nuts] Any chances/plans for the vim-go plugin to join the Go project?

2021-01-31 Thread Rupert Paddington
The VSCode Go Plugin joining the Go project (https://blog.golang.org/vscode-go) was certainly great news. Is it possible that something similar might happen with the popular vim-go plugin (https://github.com/fatih/vim-go)? -- You received this message because you are subscribed to the Google G

[go-nuts] C function return value of type float changes when used with COG

2021-01-31 Thread Robert M . Münch
I have a C library with some test-cases (using googletest) that all pass. I created Go bindings for the C lib and converted the tests to testify format. Some Go test fails because a return value from the C function (type float) is different than expected. For example: ASSERT_FLOAT_EQ(10, GetHei

Re: [go-nuts] normal mode and starve mode of sync.Mutex and runtime mutex?

2021-01-31 Thread Ian Lance Taylor
On Sun, Jan 31, 2021 at 7:07 PM robert engels wrote: > > Not sure the runtime needs it - as all lock usages are known - so the users > in the runtime can ’negotiate’ fairness through other means for a particular > mutex. Yes. The point of starvation mode in sync.Mutex is to avoid high tail lat

Re: [go-nuts] where is the g writebuf flushed?

2021-01-31 Thread Ian Lance Taylor
On Sun, Jan 31, 2021 at 12:22 PM arthurwil...@gmail.com wrote: > > in runtime/print.go gwrite, if the data is put in the gp.writebuf where does > that writebuf get flushed? The gp.writebuf field is only used to implement runtime.Stack. It isn't flushed anywhere, it's just returned to the caller

Re: [go-nuts] C function return value of type float changes when used with COG

2021-01-31 Thread Ian Lance Taylor
On Sun, Jan 31, 2021 at 9:14 PM Robert M. Münch wrote: > > I have a C library with some test-cases (using googletest) that all pass. I > created Go bindings for the C lib and converted the tests to testify format. > > Some Go test fails because a return value from the C function (type float) is

Re: [go-nuts] If the go program compiled by a completely static compiled version of go binary compiler will also be static automatically?

2021-01-31 Thread Ian Lance Taylor
On Sun, Jan 31, 2021 at 5:54 AM Hongyi Zhao wrote: > > If the go program compiled by a completely static compiled version of go > binary compiler will also be static automatically? To be more specific, on > Ubuntu 20.04, I've compiled the latest git master version of go compiler in a > complete

[go-nuts] Re: C function return value of type float changes when used with COG

2021-01-31 Thread peterGo
Robert, Advanced googletest Topics Floating-Point Comparison Comparing floating-point numbers is tricky. Due to round-off errors, it is very unlikely that two floating-points will match exactly. Therefore, ASSERT_EQ 's naive comparison usually doesn't work. And since floating-points can have

Re: [go-nuts] If the go program compiled by a completely static compiled version of go binary compiler will also be static automatically?

2021-01-31 Thread Hongyi Zhao
On Mon, Feb 1, 2021 at 1:46 PM Ian Lance Taylor wrote: > > On Sun, Jan 31, 2021 at 5:54 AM Hongyi Zhao wrote: > > > > If the go program compiled by a completely static compiled version of go > > binary compiler will also be static automatically? To be more specific, on > > Ubuntu 20.04, I've co