[go-nuts] Re: 10x latency spikes during GC alloc assist phase

2017-07-26 Thread stbaker
OK, I will add to that issue , but for the record here is our machine type and the env vars: This GCP hardware has 64 virtual CPUs (a hyperthread on a 2.6GHz Xeon E5), with 416GB memory. This is shared among other docker containers, of course, but as the trace file shows, our process uses 8

Re: [go-nuts] Details on the implementation decision for sync.Map

2017-07-26 Thread Lucio
On Wednesday, 26 July 2017 22:16:50 UTC+2, Ian Lance Taylor wrote: > > On Wed, Jul 26, 2017 at 1:07 PM, Florin Pățan > wrote: > > > > I would like to understand a bit better one particular implementation > > decision regarding the new sync.Map feature. > > [ ... ] > >

Re: [go-nuts] Is there some way to set value for unexported nil ptr field of a struct using reflect?

2017-07-26 Thread feilengcui008
Thanks for your answer :), even though the original question has been deleted. I've used the reflect.NewAt to allocate a new memory at the same address of the unexported field's reflect.Value, it seems work. for unexported not nil field if !v.CanSet() { v = reflect.NewAt(v.Type(),

Re: [go-nuts] Alternative to reflect.DeepEqual that considers "shape" of cycles?

2017-07-26 Thread Julian Andres Klode
On Wed, Jul 26, 2017 at 04:55:39PM +, Jan Mercl wrote: > On Wed, Jul 26, 2017 at 6:37 PM Julian Andres Klode > wrote: > > > Is there an existing alternative to reflect.DeepEqual() that also > respects the shape of the arguments? For example, the following tests fail: > >

Re: [go-nuts] Details on the implementation decision for sync.Map

2017-07-26 Thread Florin Pățan
On Wednesday, July 26, 2017 at 9:16:50 PM UTC+1, Ian Lance Taylor wrote: > > On Wed, Jul 26, 2017 at 1:07 PM, Florin Pățan > wrote: > > > > I would like to understand a bit better one particular implementation > > decision regarding the new sync.Map feature. > > > >

Re: [go-nuts] Details on the implementation decision for sync.Map

2017-07-26 Thread Ian Lance Taylor
On Wed, Jul 26, 2017 at 1:07 PM, Florin Pățan wrote: > > I would like to understand a bit better one particular implementation > decision regarding the new sync.Map feature. > > Besides having to introduce a new keyword to the language and some compiler > work, what were

[go-nuts] Details on the implementation decision for sync.Map

2017-07-26 Thread Florin Pățan
Hi, I would like to understand a bit better one particular implementation decision regarding the new sync.Map feature. Besides having to introduce a new keyword to the language and some compiler work, what were the other issues that pushed the implementation as part of the standard library

[go-nuts] Re: How to break a long code into lines in Golang?

2017-07-26 Thread Jonathan
Go makes it easy to use intermediates, and the code will be easier to read for someone else, possibly years from now. { intervalMS := *Int64Flag_xxIntervalMS interval := time.Duration(intervalMS) * time.Millisecond elapsed := time.Now().Sub(timeStart) time.Sleep( interval -

Re: [go-nuts] Re: Code Review - Applying functions on custom types

2017-07-26 Thread Diego Medina
I think we have a similar setup to what you are trying to do, we also started with Scala and about 3 years ago we moved it to Go (still use Scala for other parts of our app). While working in Scala and other languages you are encourage to abstract things as much as you can, in Go it is often

Re: [go-nuts] Twitter search go code

2017-07-26 Thread Shawn Milochik
On Wed, Jul 26, 2017 at 11:47 AM, Tong Sun wrote: > Any simple go code out there that can search Twitter? Thx. > > With a question this broad, you'd get much better and faster results by using Google. That said: https://www.youtube.com/watch?v=SQeAKSJH4vw=459s -- You

Re: [go-nuts] Re: Go 1.9 Release Candidate 1 is released

2017-07-26 Thread Brad Fitzpatrick
https://tip.golang.org/doc/go1.9 On Wed, Jul 26, 2017 at 7:31 AM, wrote: > Great! > > Unfortunately, the "release notes" section points to the documentation; I > can't find the actual release notes page. > > >> -- > You received this message because you are subscribed to

Re: [go-nuts] Alternative to reflect.DeepEqual that considers "shape" of cycles?

2017-07-26 Thread Jan Mercl
On Wed, Jul 26, 2017 at 6:37 PM Julian Andres Klode wrote: > Is there an existing alternative to reflect.DeepEqual() that also respects the shape of the arguments? For example, the following tests fail: a and b _are_ of equal shape and contain equal values:

[go-nuts] Alternative to reflect.DeepEqual that considers "shape" of cycles?

2017-07-26 Thread Julian Andres Klode
Is there an existing alternative to reflect.DeepEqual() that also respects the shape of the arguments? For example, the following tests fail: type List struct { next *List } func TestList(t *testing.T) { a := {} a.next = a b := {a} if reflect.DeepEqual(a, b) { t.Error("Lists are equal") } }

[go-nuts] Re: no.something seem like impossible,but it happens!!!!【 string 】causes the crash !!!!!!!!!!!!!!

2017-07-26 Thread ojucie
I mean bytes.Buffer. On Wednesday, July 26, 2017 at 8:08:13 AM UTC-3, JuciÊ Andrade wrote: > > Dear friend 3702, while you are at it, please change that string appending > strategy. Use a bufio.Buffer instead. It's way faster. > > -- You received this message because you are subscribed to the

Re: [go-nuts] Why default stack size is 1gb?

2017-07-26 Thread T L
On Wednesday, July 26, 2017 at 10:37:44 AM UTC-4, Jan Mercl wrote: > > On Wed, Jul 26, 2017 at 4:26 PM T L > wrote: > > > BTW, I think we do need a GrowCurrentStackTo API, to avoid predicted > several stack copies in stack growing. > > The specification does not requires

[go-nuts] Re: Reasoning behind behavior of range, when index is maintained

2017-07-26 Thread Christoph Berger
Hi Axel, An attempt to explain this by looking at the C-style loop only: The classic C-style for loop for i:=0; i

[go-nuts] Go Proxy Using HTTP Standard Library

2017-07-26 Thread Andrew
Hi, I've installed a Discourse forum software to a cloud server in Docker. I want to write a simple Go server and install it to the same server to serve my own website(www.mysite.com). How can I proxy all forum traffic to the Discourse(forum.mysite.com) in docker from my Go server using

[go-nuts] Re: How to break a long code into lines in Golang?

2017-07-26 Thread Tong Sun
Rule of thumb -- break anywhere *after *operation time.Sleep(time.Duration(*Int64Flag_xxIntervalMS) * time. Millisecond - time.Now().Sub(timeStart)) or, time.Sleep(time.Duration(*Int64Flag_IntervalMS) * time.Millisecond - time.Now(). Sub(timeStart)) On Tuesday, July 25,

[go-nuts] Re: How to break a long code into lines in Golang?

2017-07-26 Thread so . peter . 05
yihao yang, If you can't use a better name than Int64Flag_xxIntervalMS then at least make the code readable. For example, interval := time.Duration(*Int64Flag_xxIntervalMS) * time.Millisecond time.Sleep(interval - time.Since(timeStart)) Peter On Tuesday, July

Re: [go-nuts] Why default stack size is 1gb?

2017-07-26 Thread Jan Mercl
On Wed, Jul 26, 2017 at 4:26 PM T L wrote: > BTW, I think we do need a GrowCurrentStackTo API, to avoid predicted several stack copies in stack growing. The specification does not requires Go implementations to have any stack at all. -- -j -- You received this message

[go-nuts] Re: Go 1.9 Release Candidate 1 is released

2017-07-26 Thread johnroth1
Great! Unfortunately, the "release notes" section points to the documentation; I can't find the actual release notes page. > -- 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,

Re: [go-nuts] Why default stack size is 1gb?

2017-07-26 Thread T L
BTW, I think we do need a GrowCurrentStackTo API, to avoid predicted several stack copies in stack growing. On Monday, July 24, 2017 at 9:51:22 PM UTC-4, taozle wrote: > > my mistake, i mean the *max* stack size is 1gb which i saw it here > ,

Re: [go-nuts] Re: Code Review - Applying functions on custom types

2017-07-26 Thread Sofiane Cherchalli
The schema is statically specified. The values always arrive in a defined order. Each value has a defined type. On Tuesday, July 25, 2017 at 3:01:14 AM UTC+2, rog wrote: > > On 24 July 2017 at 23:21, Sofiane Cherchalli > wrote: > >> Yes, I'm trying to stream CSV values

Re: [go-nuts] In memory compilation and execution of Go code

2017-07-26 Thread Ian Lance Taylor
On Tue, Jul 25, 2017 at 9:53 PM, Cristian Adamo wrote: > > I'm looking for a way to compile an in memory go file and execute it within > a go program.I have been looking around the go source code and found that > perhaps something from the cmd/go/internal package could

[go-nuts] Re: 10x latency spikes during GC alloc assist phase

2017-07-26 Thread rlh
I would add to 14812 . The report should include the environment variables, HW , and RAM. The report should indicate if any environment variables are not set to the

[go-nuts] In memory compilation and execution of Go code

2017-07-26 Thread Cristian Adamo
Hi guys, I'm looking for a way to compile an in memory go file and execute it within a go program.I have been looking around the go source code and found that perhaps something from the cmd/go/internal package could be used to do such task. But my question is, is anyone familiar with that

[go-nuts] Re: Go 1.9 Release Candidate 1 is released

2017-07-26 Thread Gergely Brautigam
Yaay! Awesome! On Tuesday, 25 July 2017 18:30:06 UTC+2, Chris Broadfoot wrote: > > Hello gophers, > > We have just released go1.9rc1, a release candidate of Go 1.9. > It is cut from release-branch.go1.9 at the revision tagged go1.9rc1. > > Thank you to everyone who has helped to test Go 1.9

[go-nuts] Re: no.something seem like impossible,but it happens!!!!【 string 】causes the crash !!!!!!!!!!!!!!

2017-07-26 Thread ojucie
Dear friend 3702, while you are at it, please change that string appending strategy. Use a bufio.Buffer instead. It's way faster. > type bad.go package main import ( "fmt" "time" ) func main() { var s string begin := time.Now() for i := 0; i != 10;

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-26 Thread jesse junsay
@Konstantin K. - Yes been doing that. Have you successfully done this problem before? @Gulacsi - That's where I am right now. Thanks guys. Will let you know if I figure this out... On Wed, Jul 26, 2017 at 5:30 PM, Gulácsi Tamás wrote: > You only need to decode the

Re: [go-nuts] no.something seem like impossible,but it happens!!!!【 string 】causes the crash !!!!!!!!!!!!!!

2017-07-26 Thread Konstantin Khomoutov
On Wed, Jul 26, 2017 at 02:46:08AM -0700, 370265...@qq.com wrote: > > I think I can see at least one data race in your code. Try to run it using > > the race detector to verify. > thanks.yes,i thought this before too,but string is basic type of golang,to > read and write the same variable of

Re: [go-nuts] no.something seem like impossible,but it happens!!!!【 string 】causes the crash !!!!!!!!!!!!!!

2017-07-26 Thread 370265036
thanks.yes,i thought this before too,but string is basic type of golang,to read and write the same variable of string should not case panic i think. 在 2017年7月26日星期三 UTC+8下午5:35:24,Jan Mercl写道: > > On Wed, Jul 26, 2017 at 11:28 AM <3702...@qq.com > wrote: > > I think I can see at least one data

Re: [go-nuts] no.something seem like impossible,but it happens!!!!【 string 】causes the crash !!!!!!!!!!!!!!

2017-07-26 Thread Jan Mercl
On Wed, Jul 26, 2017 at 11:28 AM <370265...@qq.com> wrote: I think I can see at least one data race in your code. Try to run it using the race detector to verify. -- -j -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-26 Thread Gulácsi Tamás
You only need to decode the Transfer-Encoding, and treate the file as Content-Type says. jesse junsay ezt írta (időpont: 2017. júl. 26., Sze, 8:52): > Thank you Tamas... I am already done with identifying each part using the > mime multipart... My main issue now is

[go-nuts] no.something seem like impossible,but it happens!!!!【 string 】causes the crash !!!!!!!!!!!!!!

2017-07-26 Thread 370265036
the code is like this(i make it simple,but the logic is not change) const ( Ignore = "-" End= "\r\n" ) type AccessLog struct { Hash string LowerIP string FlowType int8 SendTime

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-26 Thread Konstantin Khomoutov
On Wed, Jul 26, 2017 at 02:52:05PM +0800, jesse junsay wrote: > > Check out github.com/tgulacsi/agostle - it walks the tree of mime parts > > of mail and converts everything to PDF, but you need the walk part only - > > which uses mime/multipart reader basically. > Thank you Tamas... I am already

Re: [go-nuts] Re: default --help flag behavior

2017-07-26 Thread Konstantin Khomoutov
On Thu, Jul 20, 2017 at 07:23:23AM +1000, Rob Pike wrote: >>> I realize than running `mybinary --help` returns a nice help message >>> along with a exit status 2. >>> What is the reason it doesn't return 0? [...] >> It's reasonable to consider calling a command with a flag that is not >> defined

Re: [go-nuts] Attaching to email and extracting email attachments

2017-07-26 Thread jesse junsay
Thank you Tamas... I am already done with identifying each part using the mime multipart... My main issue now is decoding it back to its binary form and save it to disk... each attachment to its own data format. jpg attachment to file.jpg, pdf attachment to file.pdf and txt attachment to

Re: [go-nuts] Reasoning behind behavior of range, when index is maintained

2017-07-26 Thread 'Axel Wagner' via golang-nuts
This is actually a really good point, thanks :) On Wed, Jul 26, 2017 at 1:37 AM, Chris Manghane wrote: > Hmm, well I can't give better reasoning off the top of my head, but I > still have to wonder why you expect the behavior of those constructs to be > the same, particularly.