[go-nuts] Re: GOMAXPROCS > num of CPU

2019-12-04 Thread Serhat Şevki Dinçer
In runtime it says: 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.

[go-nuts] tricks for installing go a single time on Windows 10 with Bash for Windows

2019-12-04 Thread Pat Farrell
I've got a new machine. I run Windows 10, but use bash all the time for all my command line stuff, and running vim, etc. When I did it on the prior machine, it was a fairly large pain to get go to work properly in all the environments, the special go shell, PowerShell, bash, etc. I'd like to

[go-nuts] Go 1.13.5 and Go 1.12.14 are released

2019-12-04 Thread Alexander Rakoczy
Hello gophers, We have just released Go versions 1.13.5 and 1.12.14, minor point releases. These releases include fixes to the go command, the runtime, the linker, and the net/http package. View the release notes for more information: https://golang.org/doc/devel/release.html#go1.13.minor

Re: [go-nuts] ask for you help about cgo and interface

2019-12-04 Thread Ian Lance Taylor
On Wed, Dec 4, 2019 at 5:21 PM FAN DEAR wrote: > > First of all, thank you very much for your reply. > Actually, what I want to do is to use golang to complete the TCP > communication SDK. > When C++ calls golang to send a message, > I need to tell the C++ message sending status at the

Re: [go-nuts] ask for you help about cgo and interface

2019-12-04 Thread FAN DEAR
First of all, thank you very much for your reply. Actually, what I want to do is to use golang to complete the TCP communication SDK. When C++ calls golang to send a message, I need to tell the C++ message sending status at the appropriate time, such as sending failed, sending successfully,

Re: [go-nuts] Weird slice of struct

2019-12-04 Thread Martin Schnabel
On 04.12.19 22:40, cstige...@gmail.com wrote: Hello Golang nuts group. I've tested golang's slice and got a weird result. Anyone can explain it? the variable ss in the for range loop is one and the same variable, with a different value of AA for each iteration. it has only one address.

Re: [go-nuts] Weird slice of struct

2019-12-04 Thread Ian Lance Taylor
On Wed, Dec 4, 2019 at 1:55 PM wrote: > Hello Golang nuts group. > > I've tested golang's slice and got a weird result. > > Anyone can explain it? > > > Why the ID of struct in the go-routine refer same address? > On this mailing list please just send code as plain text or as a link to the Go

[go-nuts] Weird slice of struct

2019-12-04 Thread cstiger99
Hello Golang nuts group. I've tested golang's slice and got a weird result. Anyone can explain it? [image: Screen Shot 2019-12-05 at 6.35.04 AM.png] [image: Screen Shot 2019-12-05 at 6.35.42 AM.png] Why the ID of struct in the go-routine refer same address? Thanks.

Re: [go-nuts] CGO - Passing pointer to C

2019-12-04 Thread Michael Jones
Speaking for the Rick Hudson Fan Club, thank you for your wonderful, amazing work on the Go GC... https://blog.golang.org/ismmkeynote ...and for this reminder that we don't want programming practice to preclude continuing innovations. On Wed, Dec 4, 2019 at 9:52 AM Rick Hudson wrote: >

[go-nuts] Building an intelligent cache in Go (functions memorization)

2019-12-04 Thread Iván Corrales Solera
Hey! https://medium.com/@ivan.corrales.solera/building-an-intelligent-cache-memorization-in-2-steps-7eb1abc1e18b I am working on beyond a go library that provides AOP. And that's just an example of beyond can do for us. I hope you find it useful . Feedback

Re: [go-nuts] Workaround for missing RWMutex.Try*Lock()

2019-12-04 Thread Robert Engels
For completeness, RWMutex.TryLock() is also needed. If you are modifying the stdlib, these are trivial changes to add these methods.-Original Message- From: Liam Sent: Dec 4, 2019 12:34 PM To: golang-nuts Subject: Re: [go-nuts] Workaround for missing RWMutex.Try*Lock() Thank you for the

Re: [go-nuts] Workaround for missing RWMutex.Try*Lock()

2019-12-04 Thread roger peppe
Thanks to Robert Clapis via Twitter for this suggestion, using channels. As he said, it doesn't quite get there, because a reader can still acquire the lock even when a writer has requested it, but it's still potentially useful and

Re: [go-nuts] Workaround for missing RWMutex.Try*Lock()

2019-12-04 Thread Liam
Thank you for the refs and pseudocode! Somehow I imagined this would be simpler... A proposal for Mutex.TryLock() was turned aside years ago because it's trivial to implement with CAS. But they didn't consider RWMutex.TryRLock(). https://github.com/golang/go/issues/6123 @ianlancetaylor, is

Re: [go-nuts] CGO - Passing pointer to C

2019-12-04 Thread Rick Hudson
Breaking the Go CGO pointer rules comes up periodically and the rules have not changed. Applications have lived with the rules simply because breaking them results in revisiting the application code every time a new Go release comes out. Did the compiler improve and some object is now

[go-nuts] GOMAXPROCS > num of CPU

2019-12-04 Thread Vincent Blanchon
Hello, I've read on GitHub (https://github.com/golang/go/issues/20303#issuecomment-329418911) "there are good reasons" to set GOMAXPROCS to > num CPU. Just out of curiosity, I want to know if someone has an example of it or any good reason to set it up more than the number of CPUs? Thanks

Re: [go-nuts] CGO - Passing pointer to C

2019-12-04 Thread Ian Lance Taylor
On Wed, Dec 4, 2019 at 6:48 AM Robert Johnstone wrote: > > Thanks for the quick reply. I had not considered the write barriers, but if > the Go objects are "live" longer than the held in C, it would work. The write barriers do not look only at the pointer being stored, they also look at the

Re: [go-nuts] CGO - Passing pointer to C

2019-12-04 Thread Robert Johnstone
Hello, Thanks for the quick reply. I had not considered the write barriers, but if the Go objects are "live" longer than the held in C, it would work. I definitely agree that there are risks associated with this approach. We are giving up some of the safety of Go. Unfortunately, we are

Re: [go-nuts] Задача: Дано число int 324. Как получить 9?

2019-12-04 Thread Jan Mercl
On Wed, Dec 4, 2019 at 2:49 PM Vital Nabokov wrote: > > Добрый день. > Задача: №1 Дано число int 324. Как получить int 9? > Задача: №2 Дано число string "324". Как получить int 9? This mailing list is in English: https://groups.google.com/forum/#!aboutgroup/golang-nuts Please use the mailing

[go-nuts] Задача: Дано число int 324. Как получить 9?

2019-12-04 Thread Vital Nabokov
Добрый день. Задача: №1 Дано число int 324. Как получить int 9? Задача: №2 Дано число string "324". Как получить int 9? -- 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

[go-nuts] Go and Mongodb partial update

2019-12-04 Thread Gabriele Bassi
Hi to allI have some trouble with golang and mongoDB i'm using the official mongodb driver for go.What i have to do is manage partial mongo db update casting a map[string]interface{} to a bison.M to perform an update.I have following collection

Re: [go-nuts] Re: Workaround for missing RWMutex.Try*Lock()

2019-12-04 Thread Robert Engels
That pkg is not a RW lock though - it is an exclusive mutex. The pseudo code I provided is a RW try lock. > On Dec 4, 2019, at 4:49 AM, pierre.cu...@gmail.com wrote: > >  > This may be of relevance to you: > https://pkg.go.dev/gvisor.dev/gvisor/pkg/tmutex?tab=doc > > > Le mercredi 4

[go-nuts] httputil proxy integrity errors on serving hugo/nginx files

2019-12-04 Thread Sankar
I have a Go proxy server which will proxy the incoming requests to a different nginx service, where a bunch of static files generated from hugo are deployed. The Go proxy server code is: ``` func (w http.ResponseWriter, r *http.Request) { proxy := httputil.NewSingleHostReverseProxy(target)

[go-nuts] Re: Workaround for missing RWMutex.Try*Lock()

2019-12-04 Thread pierre . curto
This may be of relevance to you: https://pkg.go.dev/gvisor.dev/gvisor/pkg/tmutex?tab=doc Le mercredi 4 décembre 2019 01:21:41 UTC+1, Liam a écrit : > > I have a problem that is trivially solved via > > door sync.RWMutex > > func Reader() T { >if !door.TryRLock() { // missing in stdlib :-( >

[go-nuts] Re: Go modules and project-local imports.

2019-12-04 Thread Volker Dobler
On Tuesday, 3 December 2019 18:36:49 UTC+1, Bruno Albuquerque wrote: > > It will fail because it will say it can not find "project" > > If I add a proper go.mod file in the example directory, then it works but > it actually pulls a version of project from the vcs (this is, of course, > assuming