[go-nuts] Generate string to enum using stringer.

2017-02-09 Thread tamal
Hi, We would like to be able to generate string to enum value method using stringer in addition to String() method. https://github.com/golang/tools/blob/master/cmd/stringer/stringer.go Is this something that can be added to Stringer? If yes, what is the process for that? Thanks. -- You receiv

[go-nuts] Re: Decode XML performance in golang

2017-02-09 Thread Egon
This gets you https://play.golang.org/p/J8hFZyyFF8 about 25% perf boost: BenchmarkDecode-8 3 43268 ns/op BenchmarkUnmarshal-8 3 43195 ns/op BenchmarkManual-8 5 30216 ns/op Also, Decode/Unmarshal seem pretty equal. If you don

[go-nuts] Skeleton of Go Webapp accepting file upload

2017-02-09 Thread Johann Höchtl
Can someone recommend me a skeleton of how to handle file uploads via web browser in Golang? Added Bonus: Drag & Drop would be nice but I understand that this is likely a HTML/Javascript issue. Thank you! -- You received this message because you are subscribed to the Google Groups "golang-nut

[go-nuts] [ANN] Golet can manage many services with goroutine from one golang program.

2017-02-09 Thread codehex
Hello everyone!! I tried to create one that can start, can graceful shutdown and manage multiple services at the same time in Go language. Please try it :D https://github.com/Code-Hex/golet -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To uns

[go-nuts] [Golet] We can manage many services with goroutine from one golang program.

2017-02-09 Thread codehex
Hello everyone!! I tried to create one that can start, can graceful shutdown and manage multiple services at the same time in Go language. Please try it :D https://github.com/Code-Hex/golet -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To uns

Re: [go-nuts] The feature I want most, weak *

2017-02-09 Thread Ian Lance Taylor
On Thu, Feb 9, 2017 at 4:46 PM, wrote: > > I'll look into that api and maybe it will solve my problems. Though, to be > understood I'm not asking for ARC, I'm asking for a keyword so the spec is > compatible with ARC. But you don't need a keyword to get weak pointers. Given the existence of co

Re: [go-nuts] The feature I want most, weak *

2017-02-09 Thread Andy Balholm
I expect you’re just left with the option of magic comments then, since there’s not going to be much enthusiasm for adding a new do-nothing keyword to the language. Andy -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this

Re: [go-nuts] The feature I want most, weak *

2017-02-09 Thread andrey mirtchovski
> Maybe you could use “notwithstanding". It’s an ignored token in the default > Go compiler, and a weak pointer is one that allows an object to be freed > notwithstanding any weak references to it… these are gone now: https://twitter.com/rob_pike/status/808784925402898432 -- You received this

Re: [go-nuts] ycbcr.go YCbCrToRGB implementation.

2017-02-09 Thread Nigel Tao
On Fri, Feb 10, 2017 at 10:50 AM, wrote: > It seems that all constants above are multiplied by 2^16 to allow the > calculation to be performed with integer arithmetic, before being shifted > back into an 8 bit range. But Y' is multiplied by 0x010100 which is > equivalent to Y' * 2^16 + Y' * 2^8.

[go-nuts] http://github.com/golang/protobuf has been broken for like 2 months?

2017-02-09 Thread Will Faught
Have you tried go get -u path/... ? -- 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://grou

[go-nuts] Re: Decode XML performance in golang

2017-02-09 Thread Tong Sun
Bump. I'm interested to know as well. On Wednesday, February 8, 2017 at 12:22:35 AM UTC-5, emarti...@gmail.com wrote: > > Hello, > > I'm making a go code which is basically parsing a lot of small xml > responses. I've noticed that right after I enable the parsing code, my R/S > as per wrk, as

Re: [go-nuts] Re: How could the body for a func be "provided by runtime"?

2017-02-09 Thread Sina Siadat
Thanks for the clarification. On Friday, February 10, 2017 at 3:50:15 AM UTC+3:30, Ian Lance Taylor wrote: > > On Thu, Feb 9, 2017 at 4:16 PM, Sina Siadat > wrote: > > > > One thing I still don't understand is the cases when go:linkname is > needed. > > Why not just import that package, if

Re: [go-nuts] The feature I want most, weak *

2017-02-09 Thread Andy Balholm
Maybe you could use “notwithstanding". It’s an ignored token in the default Go compiler, and a weak pointer is one that allows an object to be freed notwithstanding any weak references to it… It’s not in the spec, though, so it might cause problems with other Go implementations such as gccgo. I

Re: [go-nuts] The feature I want most, weak *

2017-02-09 Thread kpratt
I'll look into that api and maybe it will solve my problems. Though, to be understood I'm not asking for ARC, I'm asking for a keyword so the spec is compatible with ARC. > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe fro

Re: [go-nuts] The feature I want most, weak *

2017-02-09 Thread kpratt
Thx, that looks like an interesting paper. -- 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 http

Re: [go-nuts] Re: How could the body for a func be "provided by runtime"?

2017-02-09 Thread Ian Lance Taylor
On Thu, Feb 9, 2017 at 4:16 PM, Sina Siadat wrote: > > One thing I still don't understand is the cases when go:linkname is needed. > Why not just import that package, if the function is exported. Is it only > used for accessing unexported functions? Yes. It's primarily a hack that lets certain f

Re: [go-nuts] Re: How could the body for a func be "provided by runtime"?

2017-02-09 Thread Sina Siadat
Thanks, Ian! I followed your advice and got it working. :) I did two things: imported the hello package, and compiled/linked everything using go-tool-compile/link instead of go-build command. The go-build command fails, because it passes the -complete flag to the compiler. I pushed the fix to t

Re: [go-nuts] Where can I get the markdown source code of effective_go.html?

2017-02-09 Thread Ian Lance Taylor
On Thu, Feb 9, 2017 at 3:03 PM, oscaretu wrote: > > I've searching in Google and browsing and searching in the golang GitHub > repository, but I've unable to find the markdown source code used to > generate the HTML file effective_go.html There isn't any. That file has always been written in str

[go-nuts] ycbcr.go YCbCrToRGB implementation.

2017-02-09 Thread piers . powlesland
Hi I have been looking at go's implementation YCbCr to RGB conversion and there are a few details that are not clear to me. The implementation follows the JFIF spec // The JFIF specification says: // R = Y' + 1.40200*(Cr-128) // G = Y' - 0.34414*(Cb-128) - 0.71414*(Cr-128) // B = Y' + 1.77200

[go-nuts] Where can I get the markdown source code of effective_go.html?

2017-02-09 Thread oscaretu
Hello! I've searching in Google and browsing and searching in the golang GitHub repository, but I've unable to find the markdown source code used to generate the HTML file effective_go.html In URL https://github.com/golang/go/tree/master/doc I see lots of files with extension ".html", but

Re: [go-nuts] [ANN] Memo: take a note in CUI

2017-02-09 Thread mattn
Sounds good. I also have go-simplenote package. So I'll do it when I feel like. :) https://github.com/mattn/go-simplenote On Thursday, February 9, 2017 at 8:18:15 PM UTC+9, Uvelichitel wrote: > > Synchronization with simplenote service https://simplenote.com/ may be > very appreciated. simpleno

Re: [go-nuts] How can print MAP data without randomized?

2017-02-09 Thread jimmy frasche
You can create a slice of the keys in any order you want and use that to control the iteration. Map iteration is always randomized. https://play.golang.org/p/yGDUNSFMSG On Thu, Feb 9, 2017 at 1:08 PM, wrote: > hi > How can print MAP data without randomized? > > -- > You received this message be

[go-nuts] How can print MAP data without randomized?

2017-02-09 Thread erfangnulinux
hi How can print MAP data without randomized? -- 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 ht

[go-nuts] http://github.com/golang/protobuf has been broken for like 2 months?

2017-02-09 Thread Nate Finch
This bug has been open since mid-December https://github.com/golang/protobuf/issues/270 Maybe people who had it checked out before still have code there in their gopath, but for me, I get go get -u github.com/golang/protobuf/... package google.golang.org/genproto/protobuf: no buildable Go sourc

Re: [go-nuts] The feature I want most, weak *

2017-02-09 Thread Ian Lance Taylor
On Thu, Feb 9, 2017 at 1:26 AM, wrote: > The feature I want most in go is automatic reference counting. I don't > really care how mainline GC works but I want the language to be open to the > possibility of ARC-GC. In order for that to be able to handle cycles you > need a weak_ptr type that can

Re: [go-nuts] The feature I want most, weak *

2017-02-09 Thread Jesper Louis Andersen
What is your use case? The advantage of a GC over something like ARC is that you avoid having to worry about cycles in the heap. Recent GC work has reduced the traditional weakness of Tracing GCs--pauses--into a minimum (reports is 10 microseconds), so the need might not be there. There is a pape

Re: [go-nuts] Re: How could the body for a func be "provided by runtime"?

2017-02-09 Thread Ian Lance Taylor
On Thu, Feb 9, 2017 at 5:19 AM, Sina Siadat wrote: > Thank you! > > To make sure I understand what is going on I tried to reproduce the same > thing. But I can't get the compiler to find the definition of my function > even though I used the compiler directive here > > https://github.com/siadat/go

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

2017-02-09 Thread t . schulz87
+1 Am Montag, 6. Februar 2017 17:48:17 UTC+1 schrieb sven.g...@gmail.com: > > 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, sign

[go-nuts] The feature I want most, weak *

2017-02-09 Thread kpratt
The feature I want most in go is automatic reference counting. I don't really care how mainline GC works but I want the language to be open to the possibility of ARC-GC. In order for that to be able to handle cycles you need a weak_ptr type that can requires explicit graduation to a shared_ptr.

[go-nuts] Building with "go install" vs "go build"

2017-02-09 Thread Jonathan Yu
Hello Gophers! There's a fair amount of documentation available[0] about how "go install" works, particularly in contrast to "go build,"[1,2] but not a lot about which one is more idiomatic/preferred. Using the standard toolchain, it seems there's three ways to build your applications: - go buil

[go-nuts] Re: How hard it is to write android app in Go if compare to traditional Java SDK (nowadays) ?

2017-02-09 Thread Egon
On Thursday, 9 February 2017 14:50:02 UTC+2, fsn7...@gmail.com wrote: > > > Of course, there are game-engines for Go: * http://azul3d.org/ * https://github.com/EngoEngine/engo * https://hajimehoshi.github.io/ebiten/ * https://gitlab.com/xojoc/engine/ But coul

[go-nuts] Re: How could the body for a func be "provided by runtime"?

2017-02-09 Thread Sina Siadat
Thank you! To make sure I understand what is going on I tried to reproduce the same thing. But I can't get the compiler to find the definition of my function even though I used the compiler directive here https://github.com/siadat/golinkname-test/blob/master/hello/hello.go#L6 I want to link th

[go-nuts] Re: How hard it is to write android app in Go if compare to traditional Java SDK (nowadays) ?

2017-02-09 Thread fsn761304
> > >>> Of course, there are game-engines for Go: >>> * http://azul3d.org/ >>> * https://github.com/EngoEngine/engo >>> * https://hajimehoshi.github.io/ebiten/ >>> * https://gitlab.com/xojoc/engine/ >>> >>> But could I use there engines for Android ? -- You received this message because yo

[go-nuts] Re: How could the body for a func be "provided by runtime"?

2017-02-09 Thread Christian Joergensen
On Thursday, February 9, 2017 at 1:15:00 PM UTC+1, Sina Siadat wrote: > > But can't find how the compiler connects the two. > It's using the //go:linkname compiler directive: https://github.com/golang/go/blob/master/src/runtime/panic.go#L583 https://golang.org/cmd/compile/ Cheers, Christian

Re: [go-nuts] How could the body for a func be "provided by runtime"?

2017-02-09 Thread Ilya Kostarev
It's documented. From lang spec https://golang.org/ref/spec#Function_declarations "A function declaration may omit the body. Such a declaration provides the signature for a function implemented outside Go, such as an assembly routine." On Thu, 9 Feb 2017 04:15:00 -0800 (PS

[go-nuts] How could the body for a func be "provided by runtime"?

2017-02-09 Thread Sina Siadat
Hi! In $GOROOT/src/sync/mutex.go:19 there is a function declaration like this: func throw(string) // provided by runtime The function body is missing. I was wondering what is meant by "provided by runtime" and how it is done. I am guessing this is the same as the throw func defined in src/

Re: [go-nuts] [ANN] Memo: take a note in CUI

2017-02-09 Thread Ilya Kostarev
Synchronization with simplenote service https://simplenote.com/ may be very appreciated. simplenote service has huge user base(me too) due to perfect clients for android and OSX and easy sync via simperium API https://simperium.com/. But linux client been made with React app packaged in Electron is

Re: [go-nuts] *netFD.Close() will block in some case?

2017-02-09 Thread liuding234
Bug if i set write deadline, that means i hold two timers. it`s stranged 在 2017年2月9日星期四 UTC+8下午5:52:32,Jakob Borg写道: > > Yeah, for Close() on TLS connections you want to set a write deadline > before calling Close(). > > //jb > > > On 9 Feb 2017, at 10:28, liudi...@gmail.com wrote: > > > > O

Re: [go-nuts] *netFD.Close() will block in some case?

2017-02-09 Thread Jakob Borg
Yeah, for Close() on TLS connections you want to set a write deadline before calling Close(). //jb > On 9 Feb 2017, at 10:28, liuding...@gmail.com wrote: > > OH sorry. it seems has some wrong in my demo code. it should import > "crypto/tls". So Close() is in crypto/tls/conn.go. > And i found i

[go-nuts] Re: *netFD.Close() will block in some case?

2017-02-09 Thread liuding234
OH sorry. it seems has some wrong in my demo code. it should import "crypto/tls". So Close() is in crypto/tls/conn.go. And i found it blocked in "c.handshakeMutex.Lock()". I suspect that someone goroutine blocked in "c.sendAlert(alertCloseNotify)", case it`s an network IO, and i didn`t setDeadL