[go-nuts] Re: Best practices for testing?

2018-08-02 Thread Michael Gross
*Thanks for this.* *What it boils down to for me is having a better reasoning for this suggestion from CodeReviewComments:* *“The implementing package should return concrete (usually pointer or struct) types”* *And that’s the reasoning:* *“that way, **new methods can be added** to imple

[go-nuts] Help debugging atomic.AddInt64 usage

2018-08-02 Thread nanmu42
Give lower conccurency a try, like 10 requests per second. If the counter is still keeping up, never down, there may be a real issue. Handling http request takes time, it is possible that due to slower action of Mutex, the system has less concurrent load. -- You received this message because

[go-nuts] Re: Help debugging atomic.AddInt64 usage

2018-08-02 Thread keith . randall
This is definitely strange. You're using the atomics correctly. Are you on a 32-bit platform by any chance? If so, try replacing 64-bit atomics with 32-bit atomics. The 64-bit atomics should work on 32-bit platforms, but it wouldn't hurt to test that theory. If you can extract a standalone te

[go-nuts] Re: getting file path in go from uploaded file on html form

2018-08-02 Thread Nako Zeta
The file is on memory usually, you might want to save the file on your drive so you can get the path -- 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+

[go-nuts] a preservable, forgettable map iterator?

2018-08-02 Thread Dan Kortschak
Go lacks a nice way to hand around a map iteration state. There are ways to to this, but they either require handing around a doubly- wrapped closure ``` func iterator(m map[KT]VT) func(func(v VT)) { return func(fn func (v VT)) { for _, v := range m {

Re: [go-nuts] "go list"-independent way to get list of all packages in std

2018-08-02 Thread Dan Kortschak
Thanks, Ian. That makes sense now. It's irritating, but it makes sense. Relatedly, is there a way to get the output of `go list std` as though it were a JSON array. It looks to me like this is not possible, at least, not without all the other information from the documented struct. Dan On Wed, 2

[go-nuts] Re: What is rationale behind slices cannot be compared to each other with == ?

2018-08-02 Thread Andrey Tcherepanov
Thanks Jake, that is a good started for me. On Thursday, August 2, 2018 at 12:12:16 PM UTC-6, Jake Montgomery wrote: > > A previous discussion of this was quite long (89 posts) - maybe start > there: > https://groups.google.com/d/msg/golang-nuts/ajXzEM6lqJI/wbTPh2TmAwAJ > > On Thursday, August

[go-nuts] Re: What is rationale behind slices cannot be compared to each other with == ?

2018-08-02 Thread jake6502
A previous discussion of this was quite long (89 posts) - maybe start there: https://groups.google.com/d/msg/golang-nuts/ajXzEM6lqJI/wbTPh2TmAwAJ On Thursday, August 2, 2018 at 1:21:15 PM UTC-4, Andrey Tcherepanov wrote: > > The following code does not compile. What was *rationale* behind slices

[go-nuts] What is rationale behind slices cannot be compared to each other with == ?

2018-08-02 Thread Andrey Tcherepanov
The following code does not compile. What was *rationale* behind slices being excluded from being nicely comparable by == like anything else ? package main import ( "fmt" ) func main() { var a, b []byte fmt.Println("equals?", a == b) } Slices are _excluded_ from deep comparison by stating "Ot

Re: [go-nuts] stdatomic.h, cgo, and sync/atomic

2018-08-02 Thread Ian Lance Taylor
On Thu, Aug 2, 2018 at 9:28 AM, wrote: > On Wednesday, August 1, 2018 at 10:17:38 AM UTC-4, Ian Lance Taylor wrote: >> >> [...] >> That said, the exact semantics of the sync/atomic operations are not >> written down (that is https://golang.org/issue/5045). > > > I really love go, but this is one

Re: [go-nuts] stdatomic.h, cgo, and sync/atomic

2018-08-02 Thread jake6502
On Wednesday, August 1, 2018 at 10:17:38 AM UTC-4, Ian Lance Taylor wrote: > > [...] > That said, the exact semantics of the sync/atomic operations are not > written down (that is https://golang.org/issue/5045). > I really love go, but this is one thing that has annoyed me for years. This issu

[go-nuts] Decode H.264 Stream?

2018-08-02 Thread Stephen Merrony
I am the author of a Go package which, amongst things, can emit a live H.264 video stream. I am looking for a way to display (modified/overlaid) images from the stream for use in a desktop application which in turn will use my package. My requirements for a H.264 decoder are: - reliably ins

[go-nuts] Why does net/http ProxyFromEnvironment refuse to proxy localhost requests?

2018-08-02 Thread Kekoa Vincent
When using net/http ProxyFromEnvironment to specify proxy using HTTP_PROXY environment variable, there is a special case to prevent use of a proxy when connecting to a localhost or 127.0.0.1 service. Using a debugging proxy with local services is a common practice, and it was surprising to fin

[go-nuts] Kubernetes platform written in Go - We need your feedback and reviews

2018-08-02 Thread Мария
Hi everyone! We are a team of developers who have recently released Containerum platform written in Go. There's so much work lying ahead - we are currently working on delivering convenient revision control, flexible monitoring, etc. And we really need feedback from the community to know, wh

[go-nuts] Re: Help debugging atomic.AddInt64 usage

2018-08-02 Thread Marcelo Pires
if h.ServeHTTP(w, r) panic and if is panic is not recovered by the handler you should alwways do: atomic.AddInt64(&concur, 1) defer atomic.AddInt64(&concur, -1) h.ServeHTTP(w, r) defer functions always run, even in case of panic -- You received this message because you are subscribed to the Goog

[go-nuts] Re: Help debugging atomic.AddInt64 usage

2018-08-02 Thread Marcelo Pires
> > use defer, in case of panic defer will always run , but probably will be > slower than mutex > > > atomic.AddInt64(&concur, 1) defer atomic.AddInt64(&concur, -1) h.ServeHTTP(w, r) -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To un

[go-nuts] Re: Help debugging atomic.AddInt64 usage

2018-08-02 Thread Marcelo Pires
you should use uint64. and to decremente up 1 use atomic.AddUint64(&concur, ^uint64(0)) -- 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...@g

[go-nuts] Help debugging atomic.AddInt64 usage

2018-08-02 Thread James Hartig
We are having a weird case where an atomic number was increasing and not decreasing, despite calls to decrease it. Hopefully, someone on the list can point out something I'm doing wrong with the atomic package. The function with the issue is: func UnhealthyOverConcurrent(prefix string, limit in