Re: [go-nuts] database/sql doesn't return error for query-string-destination if NULL bug or feature

2020-09-11 Thread Tamás Gulácsi
database/sql.DB is a pool. If you don't want to close it, SetMaxIdleConns(1), or better, use a db.Conn(). stephan...@gmail.com a következőt írta (2020. szeptember 11., péntek, 21:02:26 UTC+2): > On Friday, 11 September 2020 at 21:04:11 UTC+3 mar...@gmail.com wrote: > >> Which sqlite driver are

Re: [go-nuts] Running goanalyzer on golang process running inside kubernetes pod

2020-09-11 Thread Siddhesh Divekar
Thanks Mhd and agree with the suggestion. However, we are trying to catch a bug which happens in production on k8s & hence trying to explore different options. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and

Re: [go-nuts] Running goanalyzer on golang process running inside kubernetes pod

2020-09-11 Thread Mhd Shulhan
Pada tanggal Sab, 12 Sep 2020 08.52, Siddhesh Divekar < siddhesh.dive...@gmail.com> menulis: > In writing to a file option, we would periodically write the file as it > might turn out to be a huge file > for the entire life of the pod to flush at once > Maybe, the obvious solution here is not

Re: [go-nuts] writing to net.Conn tcp socket

2020-09-11 Thread Mhd Shulhan
Pada tanggal Sab, 12 Sep 2020 02.54, Andy Hall menulis: > if I have multiple clients connected to a tcp server and I wish to write > back to specific connections I can record the net.Conn value and then use > the Write method on it...but when using Println I get the following for two >

[go-nuts] Re: add method to interface via reflect

2020-09-11 Thread tapi...@gmail.com
What should happen after the method is added? Will those types implementing the interface still implement it? On Thursday, September 10, 2020 at 6:44:29 PM UTC-4 va...@selfip.ru wrote: > Hi! Does go support adding method to exiting interface via reflect? > Mostly I need to add method to struct

[go-nuts] Re: godoc-static - Generate static documentation for your packages

2020-09-11 Thread tapi...@gmail.com
Cool. BTW, there is another docs generator: https://github.com/go101/gold (written by me). On Thursday, February 6, 2020 at 7:56:15 PM UTC-5 Trevor Slocum wrote: > Repository: https://gitlab.com/tslocum/godoc-static > > Demo output: https://docs.rocketnine.space > > Inspired by the recent news

[go-nuts] Re: some interesting ideas: reuse package keyword to declare generics

2020-09-11 Thread Di gg
Still a mistake there. All "MyReader" uses should be "*MyReader". On Friday, September 11, 2020 at 11:02:49 PM UTC-4 Di gg wrote: > Sorry, the last 4 lines should be: > > rs = (MyReader string)(rb) > _, _ = rs.Read(s) > rb = (MyReader []byte)(rs) > _, _ = rb.Read(bs) > > On Friday, September 11,

[go-nuts] Re: some interesting ideas: reuse package keyword to declare generics

2020-09-11 Thread Di gg
Sorry, the last 4 lines should be: rs = (MyReader string)(rb) _, _ = rs.Read(s) rb = (MyReader []byte)(rs) _, _ = rb.Read(bs) On Friday, September 11, 2020 at 11:00:12 PM UTC-4 Di gg wrote: > An example demostrating how to let Reader.Read support both string and > []byte parameters. > >

[go-nuts] Re: some interesting ideas: reuse package keyword to declare generics

2020-09-11 Thread Di gg
An example demostrating how to let Reader.Read support both string and []byte parameters. package readonlybytes[T] ( assert T.kind & (String | Slice) ) package Reader[T] ( assert readonlybytes[T] ){ type Reader interface { Read(bytes T)(n int, err error) } } package

Re: [go-nuts] Running goanalyzer on golang process running inside kubernetes pod

2020-09-11 Thread Siddhesh Divekar
In writing to a file option, we would periodically write the file as it might turn out to be a huge file for the entire life of the pod to flush at once. On Fri, Sep 11, 2020 at 6:32 PM Siddhesh Divekar wrote: > You need to write to a shared writable path that is global so when the pod >>

Re: [go-nuts] Running goanalyzer on golang process running inside kubernetes pod

2020-09-11 Thread Siddhesh Divekar
> > You need to write to a shared writable path that is global so when the pod > terminated the file is avail. That's a good idea, we can write to to a config map. The http should work too if you map the ports properly. You can be able to > access the port from outside the pod. This might not

Re: [go-nuts] alloc vs totalalloc in memory

2020-09-11 Thread Robert Engels
Because memory is reclaimed - the alloc is the “live” heap. TotalAlloc is a cumulative counter of byte allocated - bytes freed do not affect the counter. > On Sep 11, 2020, at 7:14 PM, Alexander Mills > wrote: > >  > Well why does TotalAlloc keep climbing up (increasing) in my program, but

Re: [go-nuts] Running goanalyzer on golang process running inside kubernetes pod

2020-09-11 Thread Robert Engels
You need to write to a shared writable path that is global so when the pod terminated the file is avail. The http should work too if you map the ports properly. You can be able to access the port from outside the pod. > On Sep 11, 2020, at 7:14 PM, Siddhesh Divekar > wrote: > >  > I went

Re: [go-nuts] Running goanalyzer on golang process running inside kubernetes pod

2020-09-11 Thread Siddhesh Divekar
I went through the suggested approaches and here are my thoughts. - runtime/trace.Start - The example in the doc https://golang.org/pkg/runtime/trace/ suggests adding os.Create("trace.out"), trace.Start & defer trace.Stop in the main before the application program gets started. In an environment

Re: [go-nuts] alloc vs totalalloc in memory

2020-09-11 Thread Ian Lance Taylor
On Fri, Sep 11, 2020 at 5:01 PM Alex Mills wrote: > > The explanations I find online arent very clear to me :( Well, OK, but I don't know what I can say other than to repeat the information from that link. Alloc is bytes of allocated heap objects. TotalAlloc is cumulative bytes allocated for

Re: [go-nuts] Re: Is there a gui library for Go, like Gtk+ or similar, which can be used to build statically linked executables ?

2020-09-11 Thread Philip Chapman
There is a gtk binding, but I'm not sure if it's fully cross platform. https://github.com/gotk3/gotk3 On Fri, Sep 11, 2020, 6:26 PM Kent Sandvik wrote: > I tested fyne on my Mac, hey didn't crash, that's a big plus with these > cross-platform GUI frameworks. The Look is somewhat different but

Re: [go-nuts] alloc vs totalalloc in memory

2020-09-11 Thread Alex Mills
The explanations I find online arent very clear to me :( On Thursday, September 10, 2020 at 6:40:34 PM UTC-7 Ian Lance Taylor wrote: > On Thu, Sep 10, 2020 at 4:39 PM Alexander Mills > wrote: > > > > I have this helper func to print memory usage (detect a memory leak?) > > > > > > func

Re: [go-nuts] Re: Is there a gui library for Go, like Gtk+ or similar, which can be used to build statically linked executables ?

2020-09-11 Thread Kent Sandvik
I tested fyne on my Mac, hey didn't crash, that's a big plus with these cross-platform GUI frameworks. The Look is somewhat different but with some tweaks it could be made manageable. But for any large text-based application with text styling and so forth I would use Electron or a similar

[go-nuts] Re: Is there a gui library for Go, like Gtk+ or similar, which can be used to build statically linked executables ?

2020-09-11 Thread Serge Hulne
I had a look again at "Fyne". It seems to have improved a lot lately, in particular the default size for fonts etc seems much better! Thanks again for the suggestion. On Sunday, 2 August 2020 at 23:43:56 UTC+2 ma...@eliasnaur.com wrote: > On Sunday, 2 August 2020 at 23:24:20 UTC+2

[go-nuts] writing to net.Conn tcp socket

2020-09-11 Thread Andy Hall
if I have multiple clients connected to a tcp server and I wish to write back to specific connections I can record the net.Conn value and then use the Write method on it...but when using Println I get the following for two clients... &{{0xc94000}} &{{0xc94080}} which when testing with

Re: [go-nuts] Proposal: auto return String instead of []byte if requested

2020-09-11 Thread Kevin Chadwick
On 2020-09-11 19:08, Ian Lance Taylor wrote: > The way Go works, ioutil.ReadFile is compiled with the io/ioutil > package. It can't change based on how it is called. So it is always > going to return []byte. Ok. I figured it might save an allocation as well if the coder made clear their

Re: [go-nuts] Proposal: auto return String instead of []byte if requested

2020-09-11 Thread Ian Lance Taylor
On Fri, Sep 11, 2020 at 9:45 AM Kevin Chadwick wrote: > > I apologise if this has already been discussed. Google didn't turn up anything > directly related. > > If you read a file using the following that returns a byte slice. > > tlsCertb, err := ioutil.ReadFile("/etc/ssl/mycert") > if err !=

Re: [go-nuts] Running goanalyzer on golang process running inside kubernetes pod

2020-09-11 Thread Robert Engels
Please read golang.org/cmd/trace You need a trace file. There are many ways to capture one. > On Sep 11, 2020, at 12:09 PM, Siddhesh Divekar > wrote: > >  > Ok, let me get them working first. > > My concern with pprof is it has to be made part of my process. > We had an issue where user

Re: [go-nuts] database/sql doesn't return error for query-string-destination if NULL bug or feature

2020-09-11 Thread Stephan Lukits
On Friday, 11 September 2020 at 21:04:11 UTC+3 mar...@gmail.com wrote: > Which sqlite driver are you using? That sounds like a bug. > "github.com/mattn/go-sqlite3" > > On Fri, Sep 11, 2020 at 10:56 AM Stephan Lukits wrote: > >> I passed a string-type pointer (as last destination) to a

[go-nuts] Re: Proposal: auto return String instead of []byte if requested

2020-09-11 Thread Volker Dobler
Please no. This is just begging for problems. A simple type conversion is 1 (one!) line and pretty clear. Once you open this can of worms someone would like to have a []rune and then automatic conversions from int32 to int and 6 month later you have a JavaScript like nonsense language just

Re: [go-nuts] database/sql doesn't return error for query-string-destination if NULL bug or feature

2020-09-11 Thread Marcin Romaszewicz
Which sqlite driver are you using? That sounds like a bug. On Fri, Sep 11, 2020 at 10:56 AM Stephan Lukits wrote: > I passed a string-type pointer (as last destination) to a sql.DB.Query > call which had a NULL value as field value. No error was returned and all > other fields got the

[go-nuts] database/sql doesn't return error for query-string-destination if NULL bug or feature

2020-09-11 Thread Stephan Lukits
I passed a string-type pointer (as last destination) to a sql.DB.Query call which had a NULL value as field value. No error was returned and all other fields got the appropriate values but the connection was silently closed. I noticed because it was an in-memory (sqlite3) database which all of

[go-nuts] Q about memory allocation/cleanup with interfaces

2020-09-11 Thread Christopher Crotty
Apologies in advance if this is not the right group to post this... I am having a memory leak issue in an app that reads data reports from a sensor and stores them for a length of time. Running pprof on the app, It appears that the memory is not getting released when the old data is purged.

Re: [go-nuts] Running goanalyzer on golang process running inside kubernetes pod

2020-09-11 Thread Siddhesh Divekar
Ok, let me get them working first. My concern with pprof is it has to be made part of my process. We had an issue where user requests were not reaching our http server itself. In this case what are my options if pprof server is not reachable when we hit the same issue again. Are there any other

[go-nuts] Proposal: auto return String instead of []byte if requested

2020-09-11 Thread Kevin Chadwick
I apologise if this has already been discussed. Google didn't turn up anything directly related. If you read a file using the following that returns a byte slice. tlsCertb, err := ioutil.ReadFile("/etc/ssl/mycert") if err != nil { log.Fatal(err) } tlsCert = string(tlsCertb) Is there a way to

Re: [go-nuts] zombie parent scenario with golang

2020-09-11 Thread Uday Kiran Jonnala
Hi Kurtis, Thanks for the reply. I was giving C code to show the behavior of defunct with threads still executing in a process. I do feel defunct process should not have any associated resources or threads held. Could be an issue with this Linux version, will check on the behavior in Linux

Re: [go-nuts] Running goanalyzer on golang process running inside kubernetes pod

2020-09-11 Thread Robert Engels
I would start with making sure you can get the standard ‘go tool trace’ and ‘pprof’ working. Once you have those working ‘goanalyzer’ is an enhanced version. The docs are far more complete and substantial on the standard tools. > On Sep 11, 2020, at 1:37 AM, Siddhesh Divekar > wrote: > >

Re: [go-nuts] unit test for function which has goroutine

2020-09-11 Thread roger peppe
On Thu, 10 Sep 2020 at 08:15, Yvonne Zhang wrote: > Hi, > I have a function streaming a zipreader to browser. It is like this. > func functionA()(body io.ReadCloser, err error){ > >// some logic to get a zipreader > >body, pipeWriter := io.Pipe() >zipWriter :=

Re: [go-nuts] Running goanalyzer on golang process running inside kubernetes pod

2020-09-11 Thread Siddhesh Divekar
Is there any dependency on GOPATH while running `./goanalyzer binary trace-file` ? Also my goanalyzer is built on mac and am trying to look at trace file generated on ubuntu (shouldn't be a problem). ./goanalyzer ~/workspace/binary ~/workspace/trace 2020/09/10 23:27:32 Parsing trace...

Re: [go-nuts] zombie parent scenario with golang

2020-09-11 Thread Bakul Shah
1. Looks like*something* in ps reports process/thread state incorrectly. It should not report until all the pthreads have exited and the parent has not picked up the status. The runtime will call exit() when the last thread terminates (exit() in turn will call the _exit syscall). 2. If any