Re: [go-nuts] Which is a best practice, long run goroutine or short term one?

2017-01-06 Thread Dave Cheney
Can you paste the *complete* crash output, the entire list of goroutines, from the crash? It should be straight forward to explain what has gone wrong. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop recei

Re: [go-nuts] Which is a best practice, long run goroutine or short term one?

2017-01-06 Thread Hoping White
Actually, I meet two kind of crash, “pthread_create failed" and “out of memory”. But it’s kind of a heisenbug, I can’t always reproduce it. > 在 2017年1月7日,下午2:14,Michael Jones 写道: > > It is difficult imagine "pthread_create failed" as the result of too many > goroutines. > > On Fri, Jan 6, 2017

Re: [go-nuts] Which is a best practice, long run goroutine or short term one?

2017-01-06 Thread Michael Jones
It is difficult imagine "pthread_create failed" as the result of too many goroutines. On Fri, Jan 6, 2017 at 8:11 PM, Hoping White wrote: > Hi, all > > I’m writing a chat server like program, and I must make a decision now. > My business includes two kind of things: > 1. request->response > 2. p

Re: [go-nuts] package net/http/pprof causes memory increase

2017-01-06 Thread Dave Cheney
What about the other two suggestions in my previous message. > On 7 Jan 2017, at 15:00, Hoping White wrote: > > Sorry, I have tried to provide a simple runnable example to show this > problem, but failed > > It seems that has some connection with the complexity of the program. >> 在 2017年1月4日

Re: [go-nuts] explain CLA terms

2017-01-06 Thread Will Norris
The Google CLA is based on the Apache CLA , which shares the same copyright language as the Apache 2.0 License (section 2). The vast majority of Google's open source projects use the Apache license, so in those

[go-nuts] Which is a best practice, long run goroutine or short term one?

2017-01-06 Thread Hoping White
Hi, all I’m writing a chat server like program, and I must make a decision now. My business includes two kind of things: 1. request->response 2. push message One solution is like every connection has 3 goroutines: 1. for read request 2. for write response 3. for execute request But this kind of

Re: [go-nuts] package net/http/pprof causes memory increase

2017-01-06 Thread Hoping White
Sorry, I have tried to provide a simple runnable example to show this problem, but failed It seems that has some connection with the complexity of the program. > 在 2017年1月4日,下午2:52,Dave Cheney 写道: > > Can you provide a runnable sample which shows the problem? > > How are you determining you ar

Re: [go-nuts] Efficient ForEach() on a map protected by a mutex

2017-01-06 Thread Jan Mercl
On Sat, Jan 7, 2017 at 2:12 AM tsuna wrote: > Is there a better way? Is fn allowed to mutate the map? If not then the locking/unlocking is not necessary at all. If yes then there's a race between acquiring the k,v pair from the map under a lock and calling fn with those, now possibly obsolete va

[go-nuts] Re: Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Diego Medina
> All of our build servers are locked down and cannot reach public Internet, only our local library mirror. With this in mind, you could use gvt https://github.com/FiloSottile/gvt all your devs should use it to fetch dependencies, yes, they would use open internet, but only while they get their

[go-nuts] Efficient ForEach() on a map protected by a mutex

2017-01-06 Thread tsuna
Hi there, I have a struct that contains an unexported map protected by a mutex, let’s say something like: type Map struct { mtx sync.Mutex col map[string]interface{} } I want to implement a ForEach method that works in O(1) space and doesn’t hold the mutex while working on each entry. This is wh

Re: [go-nuts] Re: Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Wojciech S. Czarnecki
Dnia 2017-01-06, o godz. 14:19:28 Jacek Furmankiewicz napisał(a): > What happens when you have multiple projects, all with different versions > of the same library ( some projects are newer, some older, some more > maintained than others, etc). > > Would you need a different GOPATH per project?

Re: [go-nuts] Re: Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Justin Israel
On Sat, Jan 7, 2017 at 9:19 AM Jacek Furmankiewicz wrote: > What happens when you have multiple projects, all with different versions > of the same library ( some projects are newer, some older, some more > maintained than others, etc). > > Would you need a different GOPATH per project? > That

[go-nuts] Golang structure CLI app

2017-01-06 Thread Sayth Renshaw
Hi Of i am going to parse a file in several different ways. The file type in is the same just selection parsed would differ should i have va separate file for each parsing option and one as the main that runs them? So that at command line use could run Someapp file_in --option1 or --all etc.

Re: [go-nuts] logger and timestamp

2017-01-06 Thread Tyler Compton
The log package defines a "standard logger" with some preconfigured flags to give you the date and time. I modified your Playground link to have the same flags as the standard logger: https://play.golang.org/p/lch7YIbe6T I used the SetFlags method and set it to LstdFlags, which is equal to the fl

[go-nuts] logger and timestamp

2017-01-06 Thread Tong Sun
Hi, Why using the standard `log` there is time-stamp in the output, but when using logger, there won't? Ref: https://play.golang.org/p/FaOU2KqXW6 log.Print("Hello, log file!") logger.Print("Hello, log file!") How can I add time-stamp output to logger? Thanks -- You received this message b

[go-nuts] Re: golang-beginners channel?

2017-01-06 Thread Florin Pățan
Hi Jason, Currently the Gophers Slack, https://gophers.slack.com/, has more than 12000 members and almost 500 channels. Among those channels we have a channel that's dedicated to new gophers, called golang-newbies, https://gophers.slack.com/messages/golang-newbies/ but we also have channels fo

Re: [go-nuts] Re: Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Jacek Furmankiewicz
What happens when you have multiple projects, all with different versions of the same library ( some projects are newer, some older, some more maintained than others, etc). Would you need a different GOPATH per project? On Fri, Jan 6, 2017 at 2:15 PM, Justin Israel wrote: > > > On Sat, Jan 7,

Re: [go-nuts] Re: Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Justin Israel
On Sat, Jan 7, 2017, 9:04 AM Jacek Furmankiewicz wrote: > Hi Daniel. > > I participated in the great Go survey on dependency management a while > back and raised these concerns there. > I read the summary of that once it was completed and was kinda > disappointed to see that none of this points s

Re: [go-nuts] enforce go source pretty printing

2017-01-06 Thread mhhcbon
yeah, but this output of go/format.Print really hurts me bad, "call": func(fn interface { }, args []interface { }) (interface { }, error) { return nil, nil }, "html": func(args []interface { }) string { return "" }, "index": func(item interface { }, indices []interface { }) (interface

[go-nuts] Re: Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Jacek Furmankiewicz
Hi Daniel. I participated in the great Go survey on dependency management a while back and raised these concerns there. I read the summary of that once it was completed and was kinda disappointed to see that none of this points seem to be getting addressed or even acknowledged as a problem. h

[go-nuts] Re: Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Daniel Theophanes
Jacek, This is a known usecase, one which other companies also operate under. Right now the tooling isn't great. However this is known and I hope that this will be better addressed in the next 6 months. A number of people will be focusing on dependency management this year. Some projects allow

Re: [go-nuts] Unmarshal mixed XML content

2017-01-06 Thread John Leidegren
Yeah, I was using regexp at one point. It's less code but it just isn't right to parse XML with it. Not when the xml.Decoder exposes such a nice API. On Friday, January 6, 2017 at 12:55:37 PM UTC+1, Egon wrote: > > > > On Friday, 6 January 2017 13:28:22 UTC+2, John Leidegren wrote: >> >> So afte

Re: [go-nuts] Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Jacek Furmankiewicz
in theory, sure. In practice, not always. We've had really difficult individuals who refused to be bothered with going through proper license review. Some of them don't work here any more. In once case it was a team lead, so peer review would not work, since the whole team "learned" to ignore p

Re: [go-nuts] Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Henrik Johansson
I would go with vendoring and proper education combined with peer review. The hoops you go through to maintain "control" seems awkward at best. I mean, you do after all trust the developers with you production code... On Fri, Jan 6, 2017, 20:16 Jacek Furmankiewicz wrote: > I doubt that will fly

Re: [go-nuts] Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Jacek Furmankiewicz
I doubt that will fly. Once again there is little control. Any developer can pull in any package they want and bypass central control mechanism. The HTTP proxy suggestion seems ingenious...but pretty hard to implement from a network perspective. We have developers in the office, we have develop

Re: [go-nuts] Re: Gomobile: Getting errors when trying to build reverse example

2017-01-06 Thread glenford williams
thanks. any idea when this will merged? On Sunday, 1 January 2017 17:28:01 UTC-5, Elias Naur wrote: > > That was more difficult than expected. The CL series ending with > > https://go-review.googlesource.com/c/34777/ > > should fix both problems. A backwards incompatible change had to be made > t

Re: [go-nuts] enforce go source pretty printing

2017-01-06 Thread Jan Mercl
On Fri, Jan 6, 2017 at 7:57 PM wrote: Hi, > i have a source code rendered like this, > ... > I d prefer something like this > ... Honestly, the best advice I can give is to quote https://go-proverbs.github.io/: "Gofmt's style is no one's favorite, yet gofmt is everyone's favorite." -- -j --

Re: [go-nuts] Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Justin Israel
On Sat, Jan 7, 2017, 8:00 AM Justin Israel wrote: > > > On Sat, Jan 7, 2017, 6:53 AM Jacek Furmankiewicz > wrote: > > Thank you for your answer. > > Issue is that it really is not much control with this approach. > > > If you used the suggestion from Tam's, > Silly autocorrection. I meant Tamás

Re: [go-nuts] Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Justin Israel
On Sat, Jan 7, 2017, 6:53 AM Jacek Furmankiewicz wrote: > Thank you for your answer. > > Issue is that it really is not much control with this approach. > If you used the suggestion from Tam's, to have a small http proxy which directs "go get" at your Stash, that could do the same thing as your

[go-nuts] enforce go source pretty printing

2017-01-06 Thread mhhcbon
Hi, i have a source code rendered like this, var some = map[string]interface { }{"b": func() { }, "c": func() { }, "yy": func(s string) b.SomeType { return b.SomeType{} }, "zz": func() { }, "ii": func(s string) a.Tomate { return nil }, "uu": func(s string) *b.SomeType { return nil }, "

Re: [go-nuts] Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Jacek Furmankiewicz
Thank you for your answer. Issue is that it really is not much control with this approach. Any developer could potentially pull any package, avoid license review and just commit it to their project. So there is no central point of control that can limit which libraries (exactly down to particul

[go-nuts] Re: Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Tamás Gulácsi
2017. január 6., péntek 17:35:41 UTC+1 időpontban Jacek Furmankiewicz a következőt írta: > > Hi everyone, > > We are operating in a SOC2 environment, which our customers demanded as we > host their systems and their data. > It's a common requirement for many companies in a cloud environment. > >

Re: [go-nuts] Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Robert Melton
Jacek-- In a similar setup (must be able to build without internet access) we simply used glide on the developer machines, then used https://github.com/Masterminds/rmvcsdir to remove vcs stuff and commit full deps to our local version control -- then all that is needed to build is to clone it an

[go-nuts] Using Go in a locked down SOC2 environment (dependency management hell)

2017-01-06 Thread Jacek Furmankiewicz
Hi everyone, We are operating in a SOC2 environment, which our customers demanded as we host their systems and their data. It's a common requirement for many companies in a cloud environment. One of the key requirements of SOC2 is that *all* external libraries/depdencies are mirrored internally

[go-nuts] Could Go http serve somehow use Apache modules? Interested in modsecurity in particular...

2017-01-06 Thread Glen Newton
Hello, I was wondering if Apache modules could somehow be exposed and used by Go http. My motivation is that ModSecurity is pretty attractive: https://modsecurity.org/ I know the default config for Go web is to put it behind Apache or nginx, but recent discussions https://blog.gopheracademy.

Re: [go-nuts] Facing linker issues while cross-compiling from Ubuntu/amd64 to darwin/amd64

2017-01-06 Thread Ian Lance Taylor
On Fri, Jan 6, 2017 at 4:05 AM, Kedar Babar wrote: > Thanks for looking in the issue. I run the go build with the -x, but no > where it is calling the gcc. Following is full output > > WORK=/tmp/go-build815513256 > mkdir -p $WORK/goresearch/mynet/_obj/ > mkdir -p $WORK/goresearch/mynet/_obj/exe/ >

[go-nuts] Re: Is this a compiler bug?

2017-01-06 Thread Kale B
https://golang.org/ref/spec#Comparison_operators > Pointers to distinct zero-size variables may or may not be equal. Looks like a more complicated example of https://github.com/golang/go/issues/8938. On Friday, January 6, 2017 at 2:24:39 AM UTC-8, Ignazio Di Napoli wrote: > > I'm very curious ab

[go-nuts] Re: Is this a compiler bug?

2017-01-06 Thread P Q
Using inherent print function, you can see this more clearly: https://play.golang.org/p/WKk7n9U2zt -- 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+un

Re: [go-nuts] Facing linker issues while cross-compiling from Ubuntu/amd64 to darwin/amd64

2017-01-06 Thread Kedar Babar
Thanks for looking in the issue. I run the go build with the -x, but no where it is calling the gcc. Following is full output WORK=/tmp/go-build815513256 mkdir -p $WORK/goresearch/mynet/_obj/ mkdir -p $WORK/goresearch/mynet/_obj/exe/ cd /home/administrator/GoWork/src/goresearch/mynet CGO_LDFLAGS=

Re: [go-nuts] Unmarshal mixed XML content

2017-01-06 Thread Egon
On Friday, 6 January 2017 13:28:22 UTC+2, John Leidegren wrote: > > So after talking a look at the xml package again I noticed the > UnmarshalXML trap. So I used that. Here's the solution I went with. > > I wrapped the decoder in a recursive decent parser to make the actual > UnmarshalXML metho

[go-nuts] Re: Is this a compiler bug?

2017-01-06 Thread Ignazio Di Napoli
Thank you! > > -- 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...@googlegroups.com. For more options, visit https://groups.google.com/d/optou

[go-nuts] Re: Is this a compiler bug?

2017-01-06 Thread Uli Kunitz
The language spec seems to allow a1 and a2 to have the same address but doesn't require that to be always the case. At the one hand: *Taking the address of a composite literal generates a pointer to a unique variable initialized with the literal's value. *[Composite Literals] On the other han

Re: [go-nuts] Unmarshal mixed XML content

2017-01-06 Thread John Leidegren
So after talking a look at the xml package again I noticed the UnmarshalXML trap. So I used that. Here's the solution I went with. I wrapped the decoder in a recursive decent parser to make the actual UnmarshalXML method readable. https://play.golang.org/p/dylYB0KsyL It uses an example from th

[go-nuts] Re: Is this a compiler bug?

2017-01-06 Thread Ignazio Di Napoli
So, with Println the compiler can optimize and assign the same address to a1 and a2, and without it cannot? Why? -- 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

[go-nuts] Re: Is this a compiler bug?

2017-01-06 Thread Ignazio Di Napoli
Ok, but why does the Println changes the result? -- 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...@googlegroups.com. For more options, visit

[go-nuts] Is this a compiler bug?

2017-01-06 Thread Konstantin Khomoutov
Isn't it that bit from [1] which deals with the arrays and structures of size 0? I mean that part which says distinct values of such types might have the same address in memory. 1. https://golang.org/ref/spec#Size_and_alignment_guarantees -- You received this message because you are subscribed

[go-nuts] Is this a compiler bug?

2017-01-06 Thread Konstantin Khomoutov
Isn't it that bit from [1] which deals with the arrays and structures of size 0? I mean that part which says distinct values of such types might have the same address in memory. 1. https://golang.org/ref/spec#Size_and_alignment_guarantees -- You received this message because you are subscribed

Re: [go-nuts] Is this a compiler bug?

2017-01-06 Thread Paul Jolly
Hopefully these points help to clarify things: - The types of the parameters to compare of the shout interface type - The comparison operator == therefore operates on two interface values. With reference to the spec ( https://golang.org/ref/spec#Comparison_operators): Interface values

[go-nuts] Re: Proposal for a succinct error return syntax

2017-01-06 Thread xjru
> > But you're not going to get any new syntax accepted by the go team anyway, > certainly not a new operator. You know that already. > I don't know that at all. I'm just putting an idea out there. They may well consider it or it may inspire other ideas on their part, who knows? -- You recei

[go-nuts] Is this a compiler bug?

2017-01-06 Thread Ignazio Di Napoli
I'm very curious about the answer to this unanswered StackOverflow question: http://stackoverflow.com/questions/41357948/what-golang-compiler-will-do-when-fmt-println import ( "fmt") type shout interface { echo()} type a struct {} func (*a) echo () { fmt.Println("a")} type b stru

[go-nuts] Re: Proposal for a succinct error return syntax

2017-01-06 Thread paraiso . marc
But you're not going to get any new syntax accepted by the go team anyway, certainly not a new operator. You know that already. Le vendredi 6 janvier 2017 11:04:38 UTC+1, xjru a écrit : > > As I said, this syntax doesn't help, because it puts file into the scope > of the if block where we often

[go-nuts] Re: [ANN] Mutagen - A unique file sync utility in Go inspired by Unison

2017-01-06 Thread Jacob Howard
Ah, sorry. No, it won't do re-use blocks across files, only within a single file. -Jacob On Friday, January 6, 2017 at 12:12:16 PM UTC+2, wilk wrote: > > On 05-01-2017, Jacob Howard wrote: > > --=_Part_50_803652314.1483655759799 > > Content-Type: multipart/alternative; > > bounda

[go-nuts] Re: [ANN] Mutagen - A unique file sync utility in Go inspired by Unison

2017-01-06 Thread wilk
On 05-01-2017, Jacob Howard wrote: > --=_Part_50_803652314.1483655759799 > Content-Type: multipart/alternative; > boundary="=_Part_51_771736522.1483655759799" > > --=_Part_51_771736522.1483655759799 > Content-Type: text/plain; charset=UTF-8 > > Syncthing's transfer model is a bit

[go-nuts] Re: Proposal for a succinct error return syntax

2017-01-06 Thread xjru
As I said, this syntax doesn't help, because it puts file into the scope of the if block where we often don't want it. Reformatting it doesn't change that. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] Re: Proposal for a succinct error return syntax

2017-01-06 Thread xjru
As I said, this syntax puts file into the scope of the if block where. Reformatting it doesn't change that. -- 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 gola

Re: [go-nuts] Unmarshal mixed XML content

2017-01-06 Thread Egon
You can use xml.Decoder (https://play.golang.org/p/fkp-t4_vee). Can you show in which place OpenGL registry contains such entries? Just interested in why it is encoded that way. Also take a look at https://github.com/go-gl/glow + Egon On Friday, 6 January 2017 11:28:42 UTC+2, John Leidegren wr

Re: [go-nuts] Unmarshal mixed XML content

2017-01-06 Thread John Leidegren
OK, then I give up. If that is how it works. The source XML file I'm reading is from the OpenGL registry and I cannot change the way they structured that file. What baffles me is that I can't seem to simply concat the text nodes either. I'd like to, as an option, just read the the concatenated

[go-nuts] Re: Proposal for a succinct error return syntax

2017-01-06 Thread paraiso . marc
It would be simpler if Go fmt would let people write if statements on a single line : if file,err := os.Open(fname) ; err!=nil { return err } Here, no need for new syntax and still readable while reducing the conditional noise. And everybody could be happy. Le vendredi 6 janvier 2017 01:35:1

Re: [go-nuts] fmt verb to single quote text

2017-01-06 Thread messju mohr
If you want to generate javascript code I suggest the encoding/json package from the stdlib. Like: https://play.golang.org/p/vHKcCfWJPz On Thu, Jan 05, 2017 at 09:06:06AM -0800, bsr wrote: >Alexander. thank you very much for helping out.  >your program does output my desired string, but v

[go-nuts] Re: Typed encoding

2017-01-06 Thread ojucie
You could consider using XML instead of JSON. XML can carry type information from a XML schema. There are several tools that produce code from XML schemas. That way, it would be easy to manipulate the AST. > > -- You received this message because you are subscribed to the Google Groups "golan