Re: [go-nuts] Re: Serialization internal data to disk

2016-10-16 Thread Tamás Gulácsi
2016. október 16., vasárnap 22:55:24 UTC+2 időpontban antoni...@gmail.com a következőt írta: > > > > On Sunday, October 16, 2016 at 2:20:59 AM UTC-4, Tamás Gulácsi wrote: >> >> Please check your errors if you depend on the call's success! I.e. if you >> write into a file, f.Close must be successf

[go-nuts] How to setup go-swagger for an existing project to generate API docs

2016-10-16 Thread SakShak
I have an existing project that needs a UI for the API. I want to use go swagger but I am completely confused https://github.com/go-swagger/go-swagger/tree/master/examples/todo-list I want to set it up so I add annotations in the code and then run the command swagger generate spec and it would

Re: [go-nuts] Starting detached child process

2016-10-16 Thread me
For some reason, this does not seem to work for `ssh` (at least on OS X) unless you have `ControlPath` in ssh config. Are there any side-effects of SysProcAttr that I could be missing? On Friday, July 18, 2014 at 1:07:44 AM UTC-7, Ian Lance Taylor wrote: > > On Thu, Jul 17, 2014 at 8:12 PM, Hein

Re: [go-nuts] Why no bytes.InsertByte(s []byte, p int, b byte) []byte ?

2016-10-16 Thread Liam Breck
On Sun, Oct 16, 2016 at 5:32 PM, Ian Lance Taylor wrote: > On Sun, Oct 16, 2016 at 5:25 PM, Liam wrote: > > > > On Sunday, October 16, 2016 at 5:13:36 PM UTC-7, Ian Lance Taylor wrote: > >> > >> On Sun, Oct 16, 2016 at 3:34 PM, Liam wrote: > >> > > >> > On Sunday, October 16, 2016 at 2:56:42 PM

Re: [go-nuts] Why no bytes.InsertByte(s []byte, p int, b byte) []byte ?

2016-10-16 Thread Ian Lance Taylor
On Sun, Oct 16, 2016 at 5:25 PM, Liam wrote: > > On Sunday, October 16, 2016 at 5:13:36 PM UTC-7, Ian Lance Taylor wrote: >> >> On Sun, Oct 16, 2016 at 3:34 PM, Liam wrote: >> > >> > On Sunday, October 16, 2016 at 2:56:42 PM UTC-7, Ian Lance Taylor wrote: >> > >> >> To argue that this should go i

Re: [go-nuts] Why no bytes.InsertByte(s []byte, p int, b byte) []byte ?

2016-10-16 Thread Liam
On Sunday, October 16, 2016 at 5:13:36 PM UTC-7, Ian Lance Taylor wrote: > > On Sun, Oct 16, 2016 at 3:34 PM, Liam > > wrote: > > > > On Sunday, October 16, 2016 at 2:56:42 PM UTC-7, Ian Lance Taylor wrote: > > > >> To argue that this should go into the standard library, look at some > >> c

Re: [go-nuts] Why no bytes.InsertByte(s []byte, p int, b byte) []byte ?

2016-10-16 Thread Ian Lance Taylor
On Sun, Oct 16, 2016 at 3:34 PM, Liam wrote: > > On Sunday, October 16, 2016 at 2:56:42 PM UTC-7, Ian Lance Taylor wrote: > >> To argue that this should go into the standard library, look at some >> corpus of Go code and find out how often it occurs. If it occurs >> fairly often, you've got a goo

Re: [go-nuts] Why no bytes.InsertByte(s []byte, p int, b byte) []byte ?

2016-10-16 Thread Liam
On Sunday, October 16, 2016 at 2:56:42 PM UTC-7, Ian Lance Taylor wrote: > > > > A function to insert a byte into a slice is conspicuous by its absence. > > It's a one-liner. > append(s[:p], append([]byte{b}, s[p:]...)...) > This is already gobbledygook :) Does that read "Insert" to you

Re: [go-nuts] Is there a way to check if all pending finalizers have been executed?

2016-10-16 Thread Ian Lance Taylor
On Sat, Oct 15, 2016 at 10:16 PM, wrote: > > On Saturday, October 15, 2016 at 6:37:08 PM UTC+8, Hotei wrote: >> >> re "meaningfullness" - I think he's saying that a finalizer for a function >> called in a goroutine might not run if main() quits first, intentionally or >> otherwise. You can of co

Re: [go-nuts] Is there a way to check if all pending finalizers have been executed?

2016-10-16 Thread Ian Lance Taylor
On Sat, Oct 15, 2016 at 12:08 AM, wrote: > > On Saturday, October 15, 2016 at 8:18:04 AM UTC+8, Ian Lance Taylor wrote: >> >> On Fri, Oct 14, 2016 at 4:08 PM, 'Peter Lam' via golang-nuts >> wrote: >> > Is there someway to wait for all pending finalizers to be run? >> >> Not in general, no. Conc

Re: [go-nuts] Centos - golang 1.6/1.7 - dial tcp i/o timeout

2016-10-16 Thread Ian Lance Taylor
On Sun, Oct 16, 2016 at 9:10 AM, wrote: > > Getting dail tcp error while calling httpClient.Get or httpClient.Post > > > http client settings: > httpClient = &http.Client{ > Timeout: 30 * time.Second, > } > > Error: > > dial tcp: lookup on xx.xx.xx.xxx:53: dial udp xx.xx.xx.xxx:53: i/o timeout >

Re: [go-nuts] Why no bytes.InsertByte(s []byte, p int, b byte) []byte ?

2016-10-16 Thread Ian Lance Taylor
On Sun, Oct 16, 2016 at 1:49 PM, Liam wrote: > > A function to insert a byte into a slice is conspicuous by its absence. It's a one-liner. append(s[:p], append([]byte{b}, s[p:]...)...) (You may want to look at https://github.com/golang/go/wiki/SliceTricks). > // but instead it's gob

Re: [go-nuts] Is there a way to check if all pending finalizers have been executed?

2016-10-16 Thread 'Kevin Malachowski' via golang-nuts
In that case it's generally "better" to have an explicit Close on your Go type which causes the explicit freeing of C memory. This can be tedious depending on your specific code, though. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubs

[go-nuts] Re: Problems with lack of mentioning of interfaces implemented by a concrete type

2016-10-16 Thread Ali Demir
Eric, imagine the following scenario: You write a Java class that implements 2 different thirdparty interfaces that are very similar (Thus single impl). One of those interfaces resides in a jar that puts licensing limitations to your code/product. That becomes a problem. Go gives you the option

Re: [go-nuts] Re: Serialization internal data to disk

2016-10-16 Thread antoniosun001
On Sunday, October 16, 2016 at 2:20:59 AM UTC-4, Tamás Gulácsi wrote: > > Please check your errors if you depend on the call's success! I.e. if you > write into a file, f.Close must be successful, or else maybe it doesn't > flush at all, and your file will be empty. That's a good point, still

Re: [go-nuts] cgo: support for exporting structs?

2016-10-16 Thread Richard Wilkes
Hi, Andy. Thanks for replying. No, I was interested in the change to allow a struct defined in Go to be passed to C, even if it only supported basic types. Sounds like that part never made it in — certainly Go 1.7.1 doesn’t seem to allow me to do such things, which is unfortunate. - Rich >

Re: [go-nuts] cgo: support for exporting structs?

2016-10-16 Thread Richard Wilkes
Andy, What's the status of getting this change into Go? I have an issue that could benefit from this particular support and was curious if/when I'd be able to use it. Thanks! - Rich On Sunday, August 9, 2015 at 4:24:52 PM UTC-7, Andy Maloney wrote: > > I imagine it will take some back-and-for

[go-nuts] Centos - golang 1.6/1.7 - dial tcp i/o timeout

2016-10-16 Thread subbagudipalli
Getting dail tcp error while calling httpClient.Get or httpClient.Post http client settings: httpClient = &http.Client{ Timeout: 30 * time.Second, } Error: dial tcp: lookup on xx.xx.xx.xxx:53: dial udp xx.xx.xx.xxx:53: i/o timeout CentOS version: CentOS Linux release 7.2.1511 (Core) can

[go-nuts] Why no bytes.InsertByte(s []byte, p int, b byte) []byte ?

2016-10-16 Thread Liam
A function to insert a byte into a slice is conspicuous by its absence. Consider this code to parse /proc/meminfo into a 2D array and insert commas: MemTotal: 497464 kB MemFree: 386232 kB MemAvailable: 452420 kB Buffers:8612 kB Cached:

Re: [go-nuts] cgo: support for exporting structs?

2016-10-16 Thread Richard Wilkes
Yes, that or just a link to the CR would be good. Thanks! - Rich > On Oct 16, 2016, at 1:15 PM, Andy wrote: > > Ah - ok. > > As I recall, I submitted a CR for it but Ian pointed out an edge case I > needed to handle. I never got to it because I changed direction and it didn't > seem like a

Re: [go-nuts] Re: Duplicate File Checker Performance

2016-10-16 Thread Michael Jones
Oh, I see. Well if you must read and hash every byte of every file then you really are mostly measuring device speed. From: on behalf of Sri G Date: Sunday, October 16, 2016 at 12:17 PM To: golang-nuts Cc: Subject: Re: [go-nuts] Re: Duplicate File Checker Performance This isn't exactl

Re: [go-nuts] cgo: support for exporting structs?

2016-10-16 Thread Andy
Here is the original CR: https://go-review.googlesource.com/#/c/14060/ Locally I'd fixed the tests and added one for the unnamed struct case Ian pointed out - but I never checked this in (see attached diff). So after this is brought in line with the current source I think it just needs to be m

Re: [go-nuts] cgo: support for exporting structs?

2016-10-16 Thread Andy
Ah - ok. As I recall, I submitted a CR for it but Ian pointed out an edge case I needed to handle. I never got to it because I changed direction and it didn't seem like anyone else was interested in this modification at the time. I can dig out the diffs from my previous attempt if that would help

Re: [go-nuts] Re: Duplicate File Checker Performance

2016-10-16 Thread Sri G
This isn't exactly the same because I deleted some files but it shouldn't really matter. Switched to md5.. --- a/dup.go +++ b/dup.go @@ -3,7 +3,7 @@ package main - "crypto/sha256" + "crypto/md5" @@ -207,8 +207,8 @@ func main() { +type Hash [16]byte // appropriate for MD5 +// type

Re: [go-nuts] Re: High memory usage of math/big.putNat for web application

2016-10-16 Thread Raffaele Di Fazio
Thank you for your answer, I now understand a bit better what is going on. On Sun, Oct 16, 2016 at 7:56 PM, andrey mirtchovski wrote: > > Here some pprof result using go 1.7.1 first and tip later: > > If I understand you correctly, you still have questions about memory > management, but the natu

Re: [go-nuts] Re: High memory usage of math/big.putNat for web application

2016-10-16 Thread andrey mirtchovski
> Here some pprof result using go 1.7.1 first and tip later: If I understand you correctly, you still have questions about memory management, but the nature of the question has changed from "why does this function keep increasing memory consumption" to "why does my program consume so much memory"?

Re: [go-nuts] cgo: support for exporting structs?

2016-10-16 Thread Andy
Richard: If you're asking about: "cmd/cgo: annotate named return struct members in comments " https://go-review.googlesource.com/#/c/13061/ It looks like that was merged at some point, but I'm not sure. I abandoned my experiments with go/cgo when some of the limitations became clear. I wou

Re: [go-nuts] Re: Duplicate File Checker Performance

2016-10-16 Thread Michael Jones
Sri G, How does this time compare to my “Dup” program? I can’t test for you…since it is your filesystem…but I thought I had it going about as fast as possible a few years ago when I wrote that one. https://github.com/MichaelTJones/dup Michael From: on behalf of Sri G Date: Satu

[go-nuts] Proposal: add "future" internal type (similar to channel)

2016-10-16 Thread Sokolov Yura
"future" is commonly used synchronization abstraction. It could be implemented in a library, using mutex, channel and interface. Example: https://github.com/Workiva/go-datastructures/blob/master/futures/selectable.go But obviously, semantically future is just a channel with buffer of capacity 1

[go-nuts] Re: High memory usage of math/big.putNat for web application

2016-10-16 Thread Raffaele Di Fazio
Here some pprof result using go 1.7.1 first and tip later: go tool pprof -alloc_space lushan-server https: //localhost:8083/debug/pprof/heap Fetching profile from https://localhost:8083/debug/pprof/heap Saved profile in /Users/rdifazio/pprof/pprof.lushan-server.localhost: 8083.alloc_objects.all

[go-nuts] Native activity on android / ios

2016-10-16 Thread Ged Wed
I am using gomobile. It's very compelling. I want to use the NativeActivity to write a daemon / service in 100℅ golang. I need to expose a http2 service with it. The problem : opengl style gomobile apps are possible, but can't work out how to use NativeAxtivity to expose a http service. Anyone

[go-nuts] Re: High memory usage of math/big.putNat for web application

2016-10-16 Thread Raffaele Di Fazio
I haven't tried tip yet, but I saw this patch yesterday. It looks like this might help as I'm not using these pools directly. Over time though, I would expect the GC to free the memory allocated. It's true that I see much lower values in the profiler for the in_use memory, but I wonder why my ma