Re: [go-nuts] Is there a "strings.Clone(string) string" alike function?

2017-02-06 Thread T L
On Friday, February 3, 2017 at 10:54:59 PM UTC+8, rog wrote: > > This program reports only one allocation per operation, which seems > to indicate that your solution is already the right one: > > https://play.golang.org/p/Fx1EMYKRRd > > > Yes, but only for small strings with length <= 32 http

[go-nuts] Re: Is there something wrong with performance of select in a for loop

2017-02-06 Thread Chris Holland
Well you're waiting in the select... so yeah its going to be at the top. The tickers themselves take up quite a bit of resources, in a little test like this. I adjusted your test to remove all the tickers, and got about 4x the speed. I also set GOMAXPROCS to 1 gives it a better case against nod

[go-nuts] Re: troubleshooting 100% cpu peg - runtime._ExternalCode ?

2017-02-06 Thread Dave Cheney
https://dave.cheney.net/2013/06/19/stress-test-your-go-packages It's just a tiny script to randomly set GOMAXPROCS -- 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 t

[go-nuts] Re: troubleshooting 100% cpu peg - runtime._ExternalCode ?

2017-02-06 Thread Jason E. Aten
On Monday, February 6, 2017 at 11:55:21 PM UTC-6, Dave Cheney wrote: > > I think there are more data races in your product > Thanks for pointing that out, Dave. Fixed in latest. How were you running (what is in stress.bash?) that caused more issues that "go test -race" alone ? -- You receive

[go-nuts] Re: troubleshooting 100% cpu peg - runtime._ExternalCode ?

2017-02-06 Thread Dave Cheney
None whatsoever I'm afraid On Tuesday, 7 February 2017 16:53:45 UTC+11, Jason E. Aten wrote: > > > On Monday, February 6, 2017 at 11:49:42 PM UTC-6, Dave Cheney wrote: > >> The give away is the frequency of the gc lines. gc 15 (the 15th gc event) >> happened at 1314 seconds into your programs exe

[go-nuts] Re: troubleshooting 100% cpu peg - runtime._ExternalCode ?

2017-02-06 Thread Dave Cheney
I think there are more data races in your product http://paste.ubuntu.com/23946008/ On Tuesday, 7 February 2017 16:42:28 UTC+11, Jason E. Aten wrote: > > the race is fixed in the latest push; > a572f570c52f70c9518bc1b3e3319ff9e2424885; it was an artifact of adding > logging levels, and would ha

[go-nuts] Re: troubleshooting 100% cpu peg - runtime._ExternalCode ?

2017-02-06 Thread Jason E. Aten
On Monday, February 6, 2017 at 11:49:42 PM UTC-6, Dave Cheney wrote: > The give away is the frequency of the gc lines. gc 15 (the 15th gc event) > happened at 1314 seconds into your programs execution this tells me that gc > is likely not your problem. If it were your terminal would be swamped

[go-nuts] Re: troubleshooting 100% cpu peg - runtime._ExternalCode ?

2017-02-06 Thread Dave Cheney
> did manage to catch the processing running away again, this time at 300%, and I got some output with gctrace=1 as you suggested. I'm not sure how to read the lines though; could you advise Dave? The give away is the frequency of the gc lines. gc 15 (the 15th gc event) happened at 1314 second

[go-nuts] Re: troubleshooting 100% cpu peg - runtime._ExternalCode ?

2017-02-06 Thread Jason E. Aten
gc 15 @1314.779s 0%: 0.031+0.29+0.11 ms clock, 0.49+0/0.99/0.47+1.7 ms cpu, 167->167->164 MB, wow, does that actually mean a 1314 second garbage collection? holy canoly. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

[go-nuts] Re: troubleshooting 100% cpu peg - runtime._ExternalCode ?

2017-02-06 Thread Jason E. Aten
the race is fixed in the latest push; a572f570c52f70c9518bc1b3e3319ff9e2424885; it was an artifact of adding logging levels, and would have affected only the tests. I did manage to catch the processing running away again, this time at 300%, and I got some output with gctrace=1 as you suggested.

[go-nuts] Re: troubleshooting 100% cpu peg - runtime._ExternalCode ?

2017-02-06 Thread Dave Cheney
It looks like there are some data races in your code http://paste.ubuntu.com/23945891/ It's not possible to debug runtime problems until there are no data races. On Tuesday, 7 February 2017 16:07:55 UTC+11, Dave Cheney wrote: > > > Since there is nothing that changes in the processes over time,

[go-nuts] Re: troubleshooting 100% cpu peg - runtime._ExternalCode ?

2017-02-06 Thread Dave Cheney
> Since there is nothing that changes in the processes over time, the fact that it kicks in after a few minutes makes me think it may be a garbage collection issue. Running with GODEBUG=gctrace=1 will confirm / deny this hypothesis. On Tuesday, 7 February 2017 16:06:09 UTC+11, Jason E. Aten

[go-nuts] Re: Does my gofmt work wrongly or I don't understand something ?

2017-02-06 Thread fsn761304
On Monday, February 6, 2017 at 2:39:04 AM UTC+4, howar...@gmail.com wrote: > > What were you expecting to happen? > > The documentation says: > >Both pattern and replacement must be valid Go expressions. In the > pat‐ >tern, single-character lowercase identifiers serve as wildc

[go-nuts] troubleshooting 100% cpu peg - runtime._ExternalCode ?

2017-02-06 Thread Jason E. Aten
On linux/amd64 using go1.8rc3, I'm seeing one Go built process peg one cpu to 100% after running for a few minutes. Tasks: 499 total, 1 running, 497 sleeping, 0 stopped, 1 zombie

[go-nuts] Re: Using React with Golang? and does it make sense?

2017-02-06 Thread Kevin Powick
On Monday, 6 February 2017 23:37:15 UTC-5, so.q...@gmail.com wrote: > > > You said that Node is not required. But I thought react components are > actually JavaScript objects. > They are. They execute on the client side, in the web browser. > Would my Golang API server be responding back to

[go-nuts] Re: Using React with Golang? and does it make sense?

2017-02-06 Thread mark
A little over a year ago, I experimented with server-side React rendering in Go [1] via otto [2]. At least back then, otto wasn't fully ECMA5-compliant due to not supporting negative lookaheads in regular expressions; I had to open a PR on React [3] to remove one negative lookahead in the rende

[go-nuts] Re: GUI for simple cross-platform Go app

2017-02-06 Thread Tong Sun
On Monday, February 6, 2017 at 5:51:28 PM UTC-5, Guber nator wrote: > > Hello, > > I have started to work on a project where I will need to build a simple > cross platform GUI app in Go that will display transparent image on the > desktop (like this one: > https://upload.wikimedia.org/wikipedia

[go-nuts] Re: Using React with Golang? and does it make sense?

2017-02-06 Thread so . query
Thanks for the comment. You said that Node is not required. But I thought react components are actually JavaScript objects. Would my Golang API server be responding back to requests with those JavaScript objects for the React library to render on the client's browser? On Monday, February 6,

[go-nuts] Re: Migrating from a classic OO pattern

2017-02-06 Thread Tong Sun
On Wednesday, February 1, 2017 at 12:56:19 PM UTC-5, jul.s...@gmail.com wrote: > > ... > I'm far from having perfect understanding on the language but I'm starting > to get the differences with a «typical» OO language and how to leverage its > strengths > > I'd have to say this one: https://pl

[go-nuts] storing transaction in context

2017-02-06 Thread Dave Cheney
I'd say store that context in your transaction value, not the other way around. -- 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 golang-nuts+unsubscr...@googlegro

RE: [go-nuts] 17.3 trace.exe malware flag on win32

2017-02-06 Thread John Souvestre
I don’t see any problem when I scan it with BitDefender. I’m running the Internet Security 2016 version, build 20.0.29.1550. How about you? John John Souvestre - New Orleans LA From: golang-nuts@googlegroups.com [mailto:golang-nuts@googlegroups.com] On Behalf Of xiiop...@gmail.com

Re: [go-nuts] ssh login failed

2017-02-06 Thread Brad Fitzpatrick
Maybe Han-Wen, copied, knows. On Mon, Feb 6, 2017 at 7:00 PM, Robert Hsiung wrote: > Hi Brad: > Thanks so much for your suggestion. I run "ssh -v" and get useful > information as attachment.So,I modify the code,but occurred the different > problem as below. > ssh: handshake failed: ssh: une

[go-nuts] Re: Is there something wrong with performance of select in a for loop

2017-02-06 Thread fwang2002
I know the compare to nodejs doesn't mean anything because of different mechanism. I just want to find out what is the best way to use select, specially in a for loop. And in my messageLoop case, perhaps I have to reduce the number of channels in the select, and make multiple kind of events ro

Re: [go-nuts] ssh login failed

2017-02-06 Thread Robert Hsiung
Hi Brad: Thanks so much for your suggestion. I run "ssh -v" and get useful information as attachment.So,I modify the code,but occurred the different problem as below. ssh: handshake failed: ssh: unexpected message type 3 (expected one of [6]) // ftp package main import ( "fmt" "g

[go-nuts] storing transaction in context

2017-02-06 Thread Steven Roth
I'd like input on whether the following idea is good or bad, and why. Consider an abstract transaction, modeled as follows: func Transaction(ctx context.Context, body func(ctx context.Context) error) error func OnCommit(ctx context.Context, commitHook func(ctx context.Context)) func OnRollback(ctx

[go-nuts] Re: GUI for simple cross-platform Go app

2017-02-06 Thread Fino
I think there is no GUI lib in Golang can do software for serious business. if it is not for play&study, use QT or others is better for business decision. BR fino 在 2017年2月7日星期二 UTC+8上午6:51:28,Guber nator写道: > > Hello, > > I have started to work on a project where I will need to build a simpl

[go-nuts] 17.3 trace.exe malware flag on win32

2017-02-06 Thread xiiophen
Not sure if this is known but I seem to be getting a malware flag on go/pkg/tool/windows_386/trace.exe ie https://golang.org/pkg/runtime/trace/ of Trojan:Win32/Skeeyah.A!rfn ie https://www.microsoft.com/security/portal/threat/encyclopedia/entry.aspx?name=Trojan%3aWin32%2fSkeeyah.A!rfn when sc

Re: [go-nuts] json: cannot unmarshal array into Go value of type main error

2017-02-06 Thread Kevin Powick
Oops. I didn't see this correct answer posted by Kortschak -- Kevin Powick On Thursday, 2 February 2017 18:41:13 UTC-5, kortschak wrote: > > You have handed json.Unmarshal a non-slice/non-array type. > > Try this https://play.golang.org/p/Zl5G_Rkt26 > > > -- You received this message becaus

[go-nuts] Re: json: cannot unmarshal array into Go value of type main error

2017-02-06 Thread Kevin Powick
Since you have an array of JSON data, you need to Unmarshal it into an Array of your struct, then range over the resulting array of your struct. Updated version of your code at: https://play.golang.org/p/gnx7pjTzOT -- Kevin Powick On Thursday, 2 February 2017 18:20:49 UTC-5, Rejoy wrote: > > >

[go-nuts] Re: Using React with Golang? and does it make sense?

2017-02-06 Thread DC
Yes , it makes sense to me . You can use golang as an api server . Node helps you in SEO . Probably you can have a look at https://github.com/erikras/react-redux-universal-hot-example. Thanks, charan On Monday, February 6, 2017 at 10:39:10 PM UTC+5:30, so.q...@gmail.com wrote: > > Correct me

[go-nuts] Re: Go Fonts: request for feedback

2017-02-06 Thread Kevin Powick
Not being familiar with the field of typography, I have no idea how these changes will affect the Go fonts. However, if they make the examples shown in the Go blog from November 2016 significantly less ugly, I'm all for ti. -- Kevin Powick On Thursday, 2 February 2017 19:25:42 UTC-5, Nigel Tao

[go-nuts] Re: Using React with Golang? and does it make sense?

2017-02-06 Thread Kevin Powick
React is one of many client side (browser) JavaScript frameworks for building user interfaces. JSX is not required when using React, but is recommended as it gives you the full power of JavaScript to describe your rendered HTML. Node is not required. If you're using Go, use it to build a serve

[go-nuts] Re: Using React with Golang? and does it make sense?

2017-02-06 Thread ivan
You don't have to use server-side rendering. You can have the React client make ajax requests to your Go backend. On Monday, February 6, 2017 at 12:09:10 PM UTC-5, so.q...@gmail.com wrote: > > Correct me if I'm wrong, but in serving web apps and sites. > > Golang simply fills in the blanks for pr

[go-nuts] GUI for simple cross-platform Go app

2017-02-06 Thread Guber nator
Hello, I have started to work on a project where I will need to build a simple cross platform GUI app in Go that will display transparent image on the desktop (like this one: https://upload.wikimedia.org/wikipedia/commons/2/23/Golang.png - transparent background) always on top, no window deco

[go-nuts] Re: Go vet context leak error

2017-02-06 Thread Chad Retz
One possibility: func (s *SimplePeerConn) Read(b []byte) (n int, err error) { ctx, maybeCancelFn := func() (context.Context, context.CancelFunc) { s.deadlineLock.RLock() defer s.deadlineLock.RUnlock() if !s.readDeadline.IsZero() { return context.WithDeadline(context.Background(

Re: [go-nuts] Go vet context leak error

2017-02-06 Thread Sameer Ajmani
Perhaps just read the deadline in the lock, then do the rest outside the lock: func (s *SimplePeerConn) Read(b []byte) (n int, err error) { s.deadlineLock.RLock() deadline := s.readDeadline s.deadlineLock.RUnlock() ctx := context.Background() if !deadline.IsZero() { dctx, cancel :=

[go-nuts] Go vet context leak error

2017-02-06 Thread chad . retz
I have the following function: func (s *SimplePeerConn) Read(b []byte) (n int, err error) { ctx := context.Background() var maybeCancelFn context.CancelFunc func() { s.deadlineLock.RLock() defer s.deadlineLock.RUnlock() if !s.readDeadline.IsZero() { ctx, maybeCancelFn = con

[go-nuts] Hidden vendoring trap

2017-02-06 Thread Tamás Gulácsi
I've fallen into a quite hideous trap: after upgrading google.golang.org/grpc, my app compiled, but paniced with double "/debug/requests" handle registration in net/http. This is caused by double import of golang.org/x/net/trace, two different versions: one is in google.golang.org/grpc, the othe

[go-nuts] Question about the "Plugin already loaded" error

2017-02-06 Thread cameron
I'm curious what the reason behind this error is, and why it is based off of the path to the file the plugin was generated from, rather than something like a hash of the contents of the file (or the path of the .so file itself). To me it seems wrong to use the filepath because it means that you

Re: [go-nuts] jq (JSON Query) write support?

2017-02-06 Thread omarshariffdontlikeit
Excellent, thanks for the tip! On Monday, February 6, 2017 at 2:11:54 PM UTC, Konstantin Khomoutov wrote: > > On Mon, 6 Feb 2017 02:20:31 -0800 (PST) > omarsharif...@gmail.com wrote: > > > Just a quick one - anyone know of a JQ package that supports > > modifying values that match? I've found

Re: [go-nuts] Problems drawing on frames of an animated gif

2017-02-06 Thread gary . willoughby
Thanks! On Sunday, 5 February 2017 01:25:21 UTC, Nigel Tao wrote: > > On Mon, Jan 23, 2017 at 6:03 AM, kalekold via golang-nuts > > wrote: > > Hmm.. the source gif I'm using must be compressed. Doesn't Go handle > > compressed gifs in the same way? When you say 'I may get unexpected > results'

[go-nuts] Using React with Golang? and does it make sense?

2017-02-06 Thread so . query
Correct me if I'm wrong, but in serving web apps and sites. Golang simply fills in the blanks for predefined templates. React appears to be a bit more complicated requiring the creation of JavaScript/JSX classes representing the view. Having that rendered on the server-side and the difference a

Re: [go-nuts] ssh login failed

2017-02-06 Thread Brad Fitzpatrick
>From looking at: ssh: unable to authenticate, attempted methods [none], no supported methods remain It seems like your ssh server requires a different authentication mode and doesn't support KeyboardInteractive (a password). Does the standard ssh client work? What does "ssh -v" say? On Mon, F

Re: [go-nuts] How to idiomatically display chained errors?

2017-02-06 Thread so . query
That does look better. Are there any other examples from the Go source I can look at it? On Sunday, February 5, 2017 at 1:56:51 PM UTC-8, Lars Seipel wrote: > > On Sat, Feb 04, 2017 at 12:08:20AM -0800, so.q...@gmail.com > wrote: > > The following would print out "ERROR: Foo() ERROR: Bar() E

[go-nuts] Re: Something like Java OSGi in Go language?

2017-02-06 Thread Vimal K
After the support for plugins in Go 1.8 is there any effort in community towards Go OSGi. thanks, Vimal -- 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 golang-

[go-nuts] ssh login failed

2017-02-06 Thread Robert Hsiung
Dear all: I tried to test sftp function with below coding,but occurred problem as below. Please give me suggestions. Thanks so much. ssh: handshake failed: ssh: unable to authenticate, attempted methods [none], no supported methods remain package main import ( "fmt" "github.com/pkg/sftp" "

[go-nuts] tls: Optional client certificate authentication with VerifyClientCertIfGiven

2017-02-06 Thread sven . gerlach
Hi, I've a legacy application at hand that has a nginx as TLS offloader in front of it. Besides a simple frontend the application offers an API including a PKI infrastructure (CSRs are pushed to server, signed CRTs are returned). The nginx is configured to optionally request a client certific

Re: [go-nuts] Is there something wrong with performance of select in a for loop

2017-02-06 Thread Jesper Louis Andersen
On Sun, Feb 5, 2017 at 7:59 PM wrote: > I make a test to see the performance of select, and found the result is > not good. > > I make 1000 SeqQueue objects and run its messageLoop function (which does > a small piece of work, and is listed as below) in 1000 separate go > routines. The CPU cost i

[go-nuts] Re: Is there something wrong with performance of select in a for loop

2017-02-06 Thread Didier Spezia
A few remarks: 1/ If you want to compare to node.js, please remove the CPU profiling option from the go program - it comes with some overhead. 2/ The comparison is not really fair. node.js implements a unique event loop (everything runs on the same thread). Go generally schedules the goroutines

RE: [go-nuts] [Beginner question] Which language supports more concurrency models: Go or Java?

2017-02-06 Thread John Souvestre
Ø I probably missed a lot of things, so feel free to correct me Go’s CSP is based on lightweight threads (goroutines), messaging (channels), and “select” – all of which are built into the language, not a library. Being built in makes then easier to use than dealing with libraries. Locks and

[go-nuts] Re: Handshake failed when using builtin TLS package: no cipher suite supported by both client and server

2017-02-06 Thread James Bardin
What cipher quite is negotiated when you connect to the Heroku proxy? What version of Go are you using on the server, and are you using the default tls.Config? I don't have that client directly available to test with, but does your particular client show the expected information when you visi

Re: [go-nuts] jq (JSON Query) write support?

2017-02-06 Thread Konstantin Khomoutov
On Mon, 6 Feb 2017 02:20:31 -0800 (PST) omarshariffdontlik...@gmail.com wrote: > Just a quick one - anyone know of a JQ package that supports > modifying values that match? I've found several packages that support > reading values but none that support modifying values on match. Quick searching o

Re: [go-nuts] Re: Is there something wrong with performance of select in a for loop

2017-02-06 Thread Ilya Kostarev
Seems for me, you don't do any selection like in JS code, even any polling. Sure it would perform better. (Maybe I'm missing something, not so proficient in nodejs) On 02/06/2017 08:56 AM, fwang2...@gmail.com wrote: For compared with nodejs: if I remove all the serverDone case, only left the t

Re: [go-nuts] About 64bits alignment

2017-02-06 Thread T L
On Monday, February 6, 2017 at 11:16:22 AM UTC, T L wrote: > > > > On Monday, February 6, 2017 at 6:43:04 PM UTC+8, T L wrote: >> >> >> >> On Monday, February 6, 2017 at 3:14:22 AM UTC+8, Ian Lance Taylor wrote: >>> >>> On Sun, Feb 5, 2017 at 10:52 AM, T L wrote: >>> > Ian, thanks for the answe

Re: [go-nuts] multipart/form-data and file size

2017-02-06 Thread Jesper Louis Andersen
I think it is a good idea. The only thing you should check before going for it is what other clients are doing. Some times what is in the RFC is not what has been implemented in reality. This can mean that if you start following the RFC spec, you end up breaking some clients in the process, which c

Re: [go-nuts] About 64bits alignment

2017-02-06 Thread T L
On Monday, February 6, 2017 at 6:43:04 PM UTC+8, T L wrote: > > > > On Monday, February 6, 2017 at 3:14:22 AM UTC+8, Ian Lance Taylor wrote: >> >> On Sun, Feb 5, 2017 at 10:52 AM, T L wrote: >> > Ian, thanks for the answers. >> > >> > But I still not very confirm on many points. >> > >> > U

Re: [go-nuts] About 64bits alignment

2017-02-06 Thread T L
On Monday, February 6, 2017 at 3:14:22 AM UTC+8, Ian Lance Taylor wrote: > > On Sun, Feb 5, 2017 at 10:52 AM, T L > > wrote: > > Ian, thanks for the answers. > > > > But I still not very confirm on many points. > > > > Up to now, there are two places mention the alignments in Go. > > > >

[go-nuts] jq (JSON Query) write support?

2017-02-06 Thread omarshariffdontlikeit
Just a quick one - anyone know of a JQ package that supports modifying values that match? I've found several packages that support reading values but none that support modifying values on match. Cheers! -- You received this message because you are subscribed to the Google Groups "golang-nuts"

[go-nuts] multipart/form-data and file size

2017-02-06 Thread Manlio Perillo
Hi. I have noted that the implementation of multipart.Reader.ReadForm *knows* the size of a file, but it just discards it. Isn't it better if it make it available as a field in the FileHeader or, probably better as an additional Content-Length header? RFC 7578 says "The multipart/form-data me

[go-nuts] [ANN] .proto file (2,3) parser and formatter (protofmt)

2017-02-06 Thread Ernest Micklei
Hi, This package was created to format .proto files but could also be used to write code generators (eg. HTML doc, mocks). https://github.com/emicklei/proto Example from the unittest_proto3_arena.proto // Test messages for packed fields message TestPackedTypes { repeated int32 packed_i