[go-nuts] pprof samples

2020-04-20 Thread asaxena via golang-nuts
Hi, I am trying CPU profiling a program that runs for an hour. However when I start pprof it says Total samples are only for 1.32 min. Why are the samples not collected for the whole duration of the program ? Is there a missing setting I need to enable ? Duration: 1.14hrs, Total samples = 1.32

Re: [go-nuts] Best design to copy a struct

2020-04-20 Thread Ian Lance Taylor
On Mon, Apr 20, 2020 at 1:56 PM Thomas S wrote: > > In regexp package, the "copy" function is implemented like this : > > func (re *Regexp) Copy() *Regexp { >118 re2 := *re >119 return &re2 >120 } > > > But most of the time for getting a copy of a struct, I do something like this

Re: [go-nuts] memory leak of C functions with pprof WriteHeapProfile

2020-04-20 Thread robert engels
see https://www.gnu.org/software/libc/manual/html_node/Allocation-Debugging.html for C memory debugging > On Apr 20, 2020, at 1:19 PM, Pavan wrote: > > Hi, I am debugging memory leak in a go application. It has lot

[go-nuts] Best design to copy a struct

2020-04-20 Thread Thomas S
Hello, In regexp package, the "copy" function is implemented like this : func (re *Regexp) Copy() *Regexp { 118re2 := *re 119return &re2 120 } But most of the time for getting a copy of a struct, I do something like this : func (re Regexp) Copy() *Regexp { 119

[go-nuts] memory leak of C functions with pprof WriteHeapProfile

2020-04-20 Thread Pavan
Hi, I am debugging memory leak in a go application. It has lot of C functions called with in. I am trying to use pprof.WriteHeapProfilepprof to dump the memory allocations . after generating dump file with WriteHeapProfile, it doesnt indicate memory allocations with-in C functions. ex: If i

Re: [go-nuts] Re: x509.ParsePKCS1PrivateKey fails to parse key generated with openssl

2020-04-20 Thread Kevin Chadwick
On 2020-04-20 13:03, Pooja Lakkundi wrote: > (btw openssl version reports "OpenSSL 1.0.1f 6 Jan 2014"). But trying to use > this key with > x509.ParsePKCS1PrivateKey() > fails with following error: > > asn1: structure error: tags don't match (2 vs {class:0 tag:16 length:13 > isCompound:true}) {opt

[go-nuts] Re: OAuth2 token expiry logic

2020-04-20 Thread Uli Kunitz
The code of the expired function ensure that only the wall time is used for comparisons. My guess is that they developers of the code wanted to avoid any confusion what times are compared. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To un

Re: [go-nuts] Equivalent of os.Args but on custom input

2020-04-20 Thread Raffaele Sena
I do something similar for some of my interactive tools and ended up writing this: https://github.com/gobs/args. If interested the command parser is here: https://github.com/gobs/cmd. -- Raffaele On Mon, Apr 20, 2020 at 10:23 AM Kurtis Rader wrote: > > os.Args simply exposes the arguments passed

[go-nuts] Re: x509.ParsePKCS1PrivateKey fails to parse key generated with openssl

2020-04-20 Thread Pooja Lakkundi
Hello Ain, Did u find any solution to this. Even Iam facing same issue. On Saturday, January 30, 2016 at 10:06:16 PM UTC+5:30, Ain wrote: > > Hi > > I created an self signed pk/cert using command: > > openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 365 > -nodes > > (btw op

Re: [go-nuts] Equivalent of os.Args but on custom input

2020-04-20 Thread Kurtis Rader
os.Args simply exposes the arguments passed to the program by the operating system. On UNIX this is typically called "argv" in C/C++ programs. The parsing of those strings into two arguments is done by the shell that runs your elvish program. It is not done by os.Args. I'm not aware of any function

[go-nuts] Equivalent of os.Args but on custom input

2020-04-20 Thread Michał Łowicki
Hi, I'm working on a program which will have a prompt to enter commands like: add "foo bar" I need what os.Args provides but on custom input so to above input I would like to get: []string{"add", "foo bar"} Package os uses runtime_args(), and it isn't exported nor accepts input. Any id

Re: [go-nuts] Re: OAuth2 token expiry logic

2020-04-20 Thread ISE Development
On Monday, 20 April 2020 16:23:10 UTC+1, David Finkel wrote: > > > > On Mon, Apr 20, 2020 at 11:02 AM > wrote: > >> Whoops, you're right. I got my Time and Duration mixed up. Your question >> still stands, though. The section on Monotonic Clocks at >> https://pkg.go.dev/time?tab=doc is a bit dens

Re: [go-nuts] Re: OAuth2 token expiry logic

2020-04-20 Thread David Finkel
On Mon, Apr 20, 2020 at 11:02 AM wrote: > Whoops, you're right. I got my Time and Duration mixed up. Your question > still stands, though. The section on Monotonic Clocks at > https://pkg.go.dev/time?tab=doc is a bit dense, but my best guess is that > stripping the monotonic clock reading from th

[go-nuts] Re: OAuth2 token expiry logic

2020-04-20 Thread cratermoon
Whoops, you're right. I got my Time and Duration mixed up. Your question still stands, though. The section on Monotonic Clocks at https://pkg.go.dev/time?tab=doc is a bit dense, but my best guess is that stripping the monotonic clock reading from the Expiry ensures that the comparison is made a

[go-nuts] Re: OAuth2 token expiry logic

2020-04-20 Thread ISE Development
On Monday, 20 April 2020 15:04:54 UTC+1, crate...@gmail.com wrote: > > According to https://golang.org/pkg/time/#Duration.Round "If m <= 0, > Round returns d unchanged". So now I'm really curious, why do the Round() > at all? > But in this case, it's a time.Time value, so this applies ( https://

[go-nuts] Re: OAuth2 token expiry logic

2020-04-20 Thread cratermoon
According to https://golang.org/pkg/time/#Duration.Round "If m <= 0, Round returns d unchanged". So now I'm really curious, why do the Round() at all? s On Sunday, April 19, 2020 at 6:45:45 PM UTC-7, ise...@gmail.com wrote: > > Hi, > > I have been looking at various packages to understand how on