Re: [go-nuts] Find biggest memory holder

2019-02-07 Thread robert engels
Is that really true though I am thinking the OP has pointers in global variables, and the size of the objects pointed to are changing. The question is not very clear though. > On Feb 7, 2019, at 12:33 PM, Ian Lance Taylor wrote: > > On Thu, Feb 7, 2019 at 2:33 AM Thomas S wrote: >> >> But

[go-nuts] I Developed TUI tool for Docker.

2019-02-07 Thread sho19921005
Hello Everyone. I Developed TUI tool for Docker. If you interested, Please read this. https://medium.com/@sho19921005/i-developed-tui-tool-for-docker-ebf48da51c6a I am waiting for your impressions. Thank you. -- You received this message because you are subscribed to the Google Groups

Re: [go-nuts] A Measure of Hash Function Collisions

2019-02-07 Thread Serhat Şevki Dinçer
On Tuesday, February 5, 2019 at 12:29:32 AM UTC+3, Michael Jones wrote: > I recently did just this in an effort (successful!) to make a well-known > simple hash function be its best with minor single CPU cycle changes. > yes I am told 15 is not the best shift amount, how about this? x = x<<27

Re: [go-nuts] Request Content Length zero when copy from another Request

2019-02-07 Thread robert engels
I am not following. You stated that the usage of Len was internal and a type switch on known concrete types, so how is related to how the OP was attempting to have things work? There is no “generally accepted use of Len()”, otherwise it would not need to perform a type switch on known concrete

Re: [go-nuts] Request Content Length zero when copy from another Request

2019-02-07 Thread Dan Kortschak
I didn't mention the word internal, nor did I imply it; with documentation stating that it would be used, it is clearly *not* internal. If you look at the code in question, you can see a probable reason why a Lener interface is not used; for each of the blessed types, a concrete copy of the

Re: [go-nuts] Request Content Length zero when copy from another Request

2019-02-07 Thread Dan Kortschak
Yeah, I'm not agreeing with you. On Thu, 2019-02-07 at 07:07 -0600, Robert Engels wrote: > You are agreeing with me. A type switch on concrete types (that you > control) is far different than using an available Len() method and > assuming the same semantics.  > > > > > On Feb 7, 2019, at 1:05

Re: [go-nuts] Find biggest memory holder

2019-02-07 Thread Ian Lance Taylor
On Thu, Feb 7, 2019 at 2:33 AM Thomas S wrote: > > But now, to go forward, I need a monitoring of my globals variables. > And not of the "run consumption" of ram. > > Any ideas on how to do this efficiently ? The size of your global variables doesn't change during execution of your program, of

Re: [go-nuts] Request Content Length zero when copy from another Request

2019-02-07 Thread Dan Kortschak
Their is an assumption in the code that users don't mutate values under the feet of routines that have been called. The copy does not protect against that and is not designed for that purpose; it is there to make the GetBody function return a zeroed copy of the body (for some definition of zeroed

[go-nuts] Re: About 64bits alignment

2019-02-07 Thread T L
Is the bug zone outdated now. How about the support on other 32-bit archs? Such as mips? On Wednesday, February 1, 2017 at 12:03:59 PM UTC-4, T L wrote: > > the sync/atomic docs, https://golang.org/pkg/sync/atomic/, says in the > end of the docs > > > On x86-32, the 64-bit functions use

Re: [go-nuts] Request Content Length zero when copy from another Request

2019-02-07 Thread robert engels
And to come full circle, this poorly declared method, with hidden internal implementation details, is exactly the cause of OP’s initial problem. Not expecting that the Body passed in, and retrieved later could be used as a Body of a new request - why wouldn’t he think that ? > On Feb 7, 2019,

Re: [go-nuts] Request Content Length zero when copy from another Request

2019-02-07 Thread robert engels
So GetBody just fails… It returns NoBody in this case.. which means calling code will just break (when the original request is not one of the known types). So, according to the referenced issue, 307/308 redirects won’t work when the underlying request is not a known type. This is a very

[go-nuts] Providing more detail after a nil pointer dereference

2019-02-07 Thread Tyler Compton
After reading https://golang.org/issues/27605 (proposal: report indexes for bounds failure), I started to wonder why we don't do something similar with nil pointer dereferences. I've more than once found myself in a situation where I'm inspecting a nil pointer dereference panic and it ends up on

[go-nuts] parse timestamp in Go

2019-02-07 Thread Rajanikanth Jammalamadaka
How can I parse the following timestamp in Go? date +%y%m%d%H%M%S%N 190207202017034235995 Thanks, Raj -- 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

Re: [go-nuts] Request Content Length zero when copy from another Request

2019-02-07 Thread Dan Kortschak
Keeping a zeroed state is important for the GetBody func because the io.ReadCloser returned by GetBody can be read and closed. If there is no zero state for the next time GetBody is called, it is not idempotent. This would break the whole point of it existing. See 

Re: [go-nuts] Request Content Length zero when copy from another Request

2019-02-07 Thread Dan Kortschak
I agree that this is a brittle API and it's one that has bitten us twice (partly because - I beleive - the dev_appserver.py development server is broken in how it deals with the cases here. This is why I filed an issue - though not with great hope of a fix other than maybe improving the

Re: [go-nuts] Re: About 64bits alignment

2019-02-07 Thread Ian Lance Taylor
On Thu, Feb 7, 2019 at 3:49 PM T L wrote: > > Is the bug zone outdated now. How about the support on other 32-bit archs? > Such as mips? The bug description is not out of date. Yes, 32-bit MIPS also requires 8 byte alignment for the 64-bit operations. I sent https://golang.org/cl/161697 to

Re: [go-nuts] parse timestamp in Go

2019-02-07 Thread Rajanikanth Jammalamadaka
Thanks. This is what I had to do as also pointed out by Martin Schnabel: https://play.golang.org/p/cC3yJ2AWquk On Thu, Feb 7, 2019 at 7:10 PM Burak Serdar wrote: > On Thu, Feb 7, 2019 at 2:28 PM Rajanikanth Jammalamadaka > wrote: > > > > How can I parse the following timestamp in Go? > > > >

Re: [go-nuts] Find biggest memory holder

2019-02-07 Thread Ian Lance Taylor
On Thu, Feb 7, 2019 at 1:33 PM Thomas S wrote: > > Yes Indeed, the size are changing, because it's trees mainly, and some > maps/slices To be clear, any changes to the trees, maps, whatever, will appear in the normal memory profile. Ian -- You received this message because you are subscribed

Re: [go-nuts] Request Content Length zero when copy from another Request

2019-02-07 Thread robert engels
I see the documented use of the types in NewRequest - you are correct - I was wrong. But, it could of easily also declared that if the provided Reader is also a Lener, it uses it to determine the content length. Why have this behavior for Closer and not for Lener? Then you don’t need the type

[go-nuts] Re: parse timestamp in Go

2019-02-07 Thread bucarr
Save it as a string, then access the slice parts of the string: d := datestringtoparse YY := d[0:2] MM := d[2:4] and so forth. On Thursday, February 7, 2019 at 2:28:30 PM UTC-7, Rajanikanth Jammalamadaka wrote: > > How can I parse the following timestamp in Go? > > date +%y%m%d%H%M%S%N > >

Re: [go-nuts] Re: using docker for compiling

2019-02-07 Thread David Riley
Yes, but we have somewhat different objectives than you might. We use the Docker golang (alpine) image to build our images, and it works wonderfully (and really makes it a lot easier to cope with differences in Jenkins build nodes). However, our apps generally eventually run on Kubernetes,

Re: [go-nuts] Request Content Length zero when copy from another Request

2019-02-07 Thread robert engels
I agree with you on the correct solution - vs. the OP’s request of the GetWrapped method. I guess I still don’t understand the “zeroed” concern though. If you adhere to the “don’t mutate values…” then why do the zero copy at all ? The state of the body should still be the state it was

Re: [go-nuts] Find biggest memory holder

2019-02-07 Thread Thomas S
Thank you Ian & Robert ! Yes Indeed, the size are changing, because it's trees mainly, and some maps/slices Le jeudi 7 février 2019 19:49:13 UTC+1, robert engels a écrit : > > Is that really true though I am thinking the OP has pointers in global > variables, and the size of the objects

Re: [go-nuts] parse timestamp in Go

2019-02-07 Thread Burak Serdar
On Thu, Feb 7, 2019 at 2:28 PM Rajanikanth Jammalamadaka wrote: > > How can I parse the following timestamp in Go? > > date +%y%m%d%H%M%S%N > > 190207202017034235995 for the ymdHMS part, you can use: time.Parse("060102150405",str[:12]) I don't know if time parser has something for the %N, you

Re: [go-nuts] Re: using docker for compiling

2019-02-07 Thread akshita babel
And FYI the folder is in local system and API is on server and hence the path thing will not work, we need to send the object to API On Fri, Feb 8, 2019 at 11:09 AM akshita babel wrote: > How can I take a folder as an input in my go api and know the relative > path or absolute path of each

Re: [go-nuts] Re: using docker for compiling

2019-02-07 Thread akshita babel
How can I take a folder as an input in my go api and know the relative path or absolute path of each file in each folder On Fri, Feb 8, 2019 at 7:12 AM David Riley wrote: > Yes, but we have somewhat different objectives than you might. > > We use the Docker golang (alpine) image to build our

[go-nuts] Re: Write to file (rather then stderr) on crash

2019-02-07 Thread aphillips801
That's fine if you only have one go-routine but if you have lots then you have to recover the panic (ie catch the exception in normal parlance) in every go-routine. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group

Re: [go-nuts] Re: About 64bits alignment

2019-02-07 Thread T L
Thanks for the clarification. On Thursday, February 7, 2019 at 8:57:00 PM UTC-4, Ian Lance Taylor wrote: > > On Thu, Feb 7, 2019 at 3:49 PM T L > > wrote: > > > > Is the bug zone outdated now. How about the support on other 32-bit > archs? Such as mips? > > The bug description is not out of

[go-nuts] Find biggest memory holder

2019-02-07 Thread Thomas S
Hello, I work on a service using a big amount of RAM memory (500-100MB). Most of them is used by global variable, it's pre-processed data, allowing the service to answer quickly. However, I'm working on improving the RAM consumption. I generated PDF callgraphs with pprof. Some elementary

Re: [go-nuts] When would you use single quotes?

2019-02-07 Thread Jan Mercl
On Thu, Feb 7, 2019 at 11:25 AM Jamie Caldwell wrote: > But why would you use one over the other? Why does Go support being able to assign a codepoint using single quotes? `type rune` vs type `string` not the same, but is bit like `type byte` vs `type []byte`. The serve very different purposes.

Re: [go-nuts] When would you use single quotes?

2019-02-07 Thread Tamás Gulácsi
A rune is an int32, so it takes 4 bytes by definition. A string in a struct with position, length and backing array of bytes. The backing array here consumes 3 bytes, but tge position and length occupies space too, so the string of that rune occupies more than 3 bytes after all. -- You

Re: [go-nuts] When would you use single quotes?

2019-02-07 Thread Jamie Caldwell
Thank you for getting back to me, but I don't think you have answered my question. I understand they are a rune and string respectively. But *why* would you use one over the other? Why does Go support being able to assign a codepoint using single quotes? Also, why do they take more than three

Re: [go-nuts] When would you use single quotes?

2019-02-07 Thread Jamie Caldwell
Thank you both for your answers. It is much appreciated. The UTF8 encoding of that codepoint is three bytes. So the rune will still occupy 4 bytes, even if the last byte holds no data? I'm sorry for the school boy question! Thank you. On Thu, 7 Feb 2019, 10:52 Tamás Gulácsi A rune is an

[go-nuts] Re: When would you use single quotes?

2019-02-07 Thread peterGo
Jamie, This is a question about Unicode: The Unicode Consortium: http://unicode.org/ The Unicode Standard: http://www.unicode.org/standard/standard.html Unicode Frequently Asked Questions: UTF-8, UTF-16, UTF-32 & BOM: http://www.unicode.org/faq/utf_bom.html Briefly, a Unicode code point is

Re: [go-nuts] Request Content Length zero when copy from another Request

2019-02-07 Thread Robert Engels
You are agreeing with me. A type switch on concrete types (that you control) is far different than using an available Len() method and assuming the same semantics. > On Feb 7, 2019, at 1:05 AM, Dan Kortschak wrote: > > Addressing the first sentence, it was a direct answer to a comment you >

Re: [go-nuts] When would you use single quotes?

2019-02-07 Thread Volker Dobler
> > The UTF8 encoding of that codepoint is three bytes. So the rune will > still occupy 4 bytes, even if the last byte holds no data? > A rune has nothing to do with UTF-8. A rune stores the codepoint which is totally independent of any encoding (like UTF-8, UTF-16, UTF-23, EBCDIC, whatnot).