[go-nuts] How to decrypt data with AES in golang

2016-06-29 Thread Hoping White
Hi, all I have a C# code to decrypt data as following public static string test(string input, string key) { if (((input == null) || string.IsNullOrEmpty(input.Trim())) || ((input == "false") || (input == "null"))) { return string.Empty;

[go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2016-06-29 Thread Viktor Kojouharov
This would probably introduce unnecessary confusion. People are used to the equality operator comparing values in go, as opposed to references. It's much better if the slices finally support the equality operator, even though the comparison speed will depend on the number of items in the slices

[go-nuts] Singleton pattern for a client handle

2016-06-29 Thread krmayankk
I want a single instance of a client handle to be initialized. Is it ok to declare the instance as var client MetricsClient and then initialize it using sync.Once(). Is it required for some reason that the client be a pointer or are there are other issues with it. My requirement is to be able

[go-nuts] Re: SDK aws S3 Download to stdout

2016-06-29 Thread Dave Cheney
numBytes, err := downloader.Download(os.Stdout, &s3.GetObjectInput{ ... }) Should do it. On Thursday, 30 June 2016 13:53:31 UTC+10, Joshua Boelter wrote: > > I've been tinkering w/ the AWS Go SDK to get used to it ... this is one > method using the GetObject API; see the full gist for a working

[go-nuts] Re: SDK aws S3 Download to stdout

2016-06-29 Thread Joshua Boelter
I've been tinkering w/ the AWS Go SDK to get used to it ... this is one method using the GetObject API; see the full gist for a working example https://gist.github.com/jboelter/6f5bd598673eb0e606f10660495fc175 s3Svc := s3.New(awsSession) result, err := s3Svc.GetObject(&s3.GetObjectInput{ Bucke

Re: [go-nuts] Prevent RTS from creating an OS thread

2016-06-29 Thread Ian Lance Taylor
On Tue, Jun 28, 2016 at 2:50 PM, Martynas Pumputis wrote: > > Recently I've bumped into a problem when using the Linux network > namespaces in Go. > > In my program I have the following function: > > func do() { > runtime.LockOSThread() > defer runtime.UnlockOSThread() > netns.Set(cont

Re: [go-nuts] 'Vectorizing' array arithmetic using parallel for loops?

2016-06-29 Thread Guy Zyskind
Thanks! I'll study these examples and see how they apply. I generally don't use such big numbers, however, I may break it over sets of numbers which could distribute the work more evenly. On Wed, Jun 29, 2016 at 12:31 PM, Michael Jones wrote: > Try these versions: https://play.golang.org/p/HF6k0

[go-nuts] GUI for Go

2016-06-29 Thread Wen-Pin Hsieh
Hi all, I am new to go language. Now I am trying to develop a GUI tool with go. Are there any good choices such as QT or others to make the GUI Thanks wp -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop re

Re: [go-nuts] Handling dynamic and unknown number of wait groups?

2016-06-29 Thread Ian Lance Taylor
On Wed, Jun 29, 2016 at 9:52 AM, Inspectre Gadget wrote: > Hey everyone, > > Here’s my issue, I will try to keep this short and concise: > > I have written a program that will accept a URL, spider that URL’s domain > and scheme (http/https), and return back all input fields found throughout > to t

Re: [go-nuts] Question regarding netpoller framework implementation

2016-06-29 Thread Ian Lance Taylor
On Wed, Jun 29, 2016 at 1:28 PM, Tathagata wrote: > > I'm measuring the context switch overhead for go routines and I have a > question regarding the netpoller mechanism. I read online that the netpoller > lives in its own thread, and responds to IO events. I thought this meant > that there's a se

Re: [go-nuts] Relaxing rules on slice comparison: would it make sense?

2016-06-29 Thread Ian Lance Taylor
On Wed, Jun 29, 2016 at 11:19 AM, Chad wrote: > > Just been thinking that since a slice is a "reference" type, why not allow > slice equality? > Of course the number of cases where two slices are equal would be quite low, > irrelevant of whether the view they have on their respective arrays is the

Re: [go-nuts] semantics of byteCount in gob encoding

2016-06-29 Thread Rob Pike
Look at the simple decoder in encoding/gob/debug.go. -rob On Wed, Jun 29, 2016 at 5:07 PM, Alex Flint wrote: > Sorry to keep bothering you folks with this but does anybody have an > answer to this? > > On Tue, Jun 21, 2016 at 9:26 AM Alex Flint wrote: > >> Oh I expected that since I only call

Re: [go-nuts] semantics of byteCount in gob encoding

2016-06-29 Thread Alex Flint
Sorry to keep bothering you folks with this but does anybody have an answer to this? On Tue, Jun 21, 2016 at 9:26 AM Alex Flint wrote: > Oh I expected that since I only called encoder.Encode once, there would > only be on repetition of the outermost segment. I was expecting the > wireType to be

Re: [go-nuts] Relaxing rules on slice comparison: would it make sense?

2016-06-29 Thread Dan Kortschak
On Wed, 2016-06-29 at 11:19 -0700, Chad wrote: > Just been thinking that since a slice is a "reference" type, why not > allow > slice equality? > Of course the number of cases where two slices are equal would be > quite > low, irrelevant of whether the view they have on their respective > arrays

[go-nuts] SDK aws S3 Download to stdout

2016-06-29 Thread Dave Cheney
Try using os.Stdout as the download target. -- 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 htt

[go-nuts] Question regarding netpoller framework implementation

2016-06-29 Thread Tathagata
Hello all, I'm measuring the context switch overhead for go routines and I have a question regarding the netpoller mechanism. I read online that the netpoller lives in its own thread, and responds to IO events. I thought this meant that there's a separate machine thread that keeps polling the

[go-nuts] Handling dynamic and unknown number of wait groups?

2016-06-29 Thread Inspectre Gadget
Hey everyone, Here’s my issue, I will try to keep this short and concise: I have written a program that will accept a URL, spider that URL’s domain and scheme (http/https), and return back all input fields found throughout to the console. The purpose is largely for web application security

[go-nuts] SDK aws S3 Download to stdout

2016-06-29 Thread Walter Garcia
Hello all. Im new using AWS SDK in go and Im need download file object from S3 to Stdout and not create a file. For example: my_download_s3_program > file.txt or my_download_s3_program | tar etc So, I can download to file, but I need stream on the fly to stdout, it's possible? This example wri

Re: [go-nuts] Return different structs

2016-06-29 Thread jbogarin
On Wednesday, 29 June 2016 15:24:41 UTC-6, Shawn Milochik wrote: > > I'm thinking about something like this: > > https://play.golang.org/p/Aq8US0M-Fe > > I just used Stringer, but you could of course just create your own > interface with a function you find useful instead. > > Shaw, Thanks for

Re: [go-nuts] Return different structs

2016-06-29 Thread Shawn Milochik
I'm thinking about something like this: https://play.golang.org/p/Aq8US0M-Fe I just used Stringer, but you could of course just create your own interface with a function you find useful instead. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. T

Re: [go-nuts] Return different structs

2016-06-29 Thread Jose Bogarin Solano
Shawn, Thanks, I'll have to see how I can make that interface. Thanks for the guidance. On 29 June 2016 at 13:42, Shawn Milochik wrote: > You're welcome. I think that using empty interfaces isn't the best way to > do it. I meant (but didn't specify) that you should make an interface that > both

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2016-06-29 Thread Chad
So that it becomes valid map inputs. What should be hashed would be the slice/map/ref type value. On Wednesday, June 29, 2016 at 8:38:03 PM UTC+2, Konstantin Khomoutov wrote: > > On Wed, 29 Jun 2016 11:20:46 -0700 (PDT) > Chad > wrote: > > > And actually the same for any other similar types such

Re: [go-nuts] Return different structs

2016-06-29 Thread Shawn Milochik
You're welcome. I think that using empty interfaces isn't the best way to do it. I meant (but didn't specify) that you should make an interface that both of your struct types satisfy, and return those instead. -- You received this message because you are subscribed to the Google Groups "golang-n

Re: [go-nuts] Return different structs

2016-06-29 Thread jbogarin
Shawn, Thanks, it was an error on my side. The function actually returns an array of structs but an interface is not an array, so when I tried to return an array of interfaces, it crashed. I changed it from []interface{} to interface{} and it's working. Thanks for the help. On Tuesday, 28 Jun

Re: [go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2016-06-29 Thread Konstantin Khomoutov
On Wed, 29 Jun 2016 11:20:46 -0700 (PDT) Chad wrote: > And actually the same for any other similar types such as maps... > > > On Wednesday, June 29, 2016 at 8:19:45 PM UTC+2, Chad wrote: > > > > Just been thinking that since a slice is a "reference" type, why > > not allow slice equality? > >

[go-nuts] Re: Relaxing rules on slice comparison: would it make sense?

2016-06-29 Thread Chad
And actually the same for any other similar types such as maps... On Wednesday, June 29, 2016 at 8:19:45 PM UTC+2, Chad wrote: > > Just been thinking that since a slice is a "reference" type, why not allow > slice equality? > Of course the number of cases where two slices are equal would be quit

[go-nuts] Relaxing rules on slice comparison: would it make sense?

2016-06-29 Thread Chad
Just been thinking that since a slice is a "reference" type, why not allow slice equality? Of course the number of cases where two slices are equal would be quite low, irrelevant of whether the view they have on their respective arrays is the same. I'm thinking about something analogous to comp

Re: [go-nuts] 'Vectorizing' array arithmetic using parallel for loops?

2016-06-29 Thread Michael Jones
Try these versions: https://play.golang.org/p/HF6k0ovyoW Changes: 1. Numbers big enough that the multiplies take some time. 2. Two styles of synchronization and work distribution. Best case in this configuration is 3.9151x speedup on 4 core notebook: $ go test -bench=. testing: warning: no tes

[go-nuts] Re: File method WriteString frequent calls led to a large system cache

2016-06-29 Thread Hotei
Just guessing, but these solutions come to mind. Here's some pseudocode for what I think Tamás was trying to say... var x sync.Mutex for { sleep(24 hours) x.Lock() write/start a new daily log x.Unlock() } or get a delay by selecting on a channel something like this select { case <-time.After

Re: [go-nuts] Re: A proposal for generic in go

2016-06-29 Thread Øyvind Teig
The suggestions of generics discussed here and in the referenced documentation, will it be possible to compile the "Go-with-generics" language into some idiomatic Go and compile it with the standard compiler? (I guess *what* idiomatic means is the real question here..). Or would it break idioma

Re: [go-nuts] Where can I find the format definition of stack trace?

2016-06-29 Thread jingguo yao
Aram: Ok, Thanks. -- 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/o

Re: [go-nuts] Where can I find the format definition of stack trace?

2016-06-29 Thread Aram Hăvărneanu
On Wed, Jun 29, 2016 at 3:28 PM, Jingguo Yao wrote: > Could you point out where you find the format information? As far as I know, it is not formally documented anywhere (and can change at any time). -- Aram Hăvărneanu -- You received this message because you are subscribed to the Google Grou

Re: [go-nuts] Where can I find the format definition of stack trace?

2016-06-29 Thread Jingguo Yao
Aram: Thanks for your reply. Could you point out where you find the format information? -- Jingguo -- 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+

[go-nuts] Re: A proposal for generic in go

2016-06-29 Thread Egon
On Wednesday, 29 June 2016 14:45:09 UTC+3, Sean Russell wrote: > > On Wednesday, June 29, 2016 at 2:31:59 AM UTC-4, Egon wrote: >> >> Just to be clear what I consider a *great example* for analyzing >> generics: >> >> 2. 3+ real-world packages/applications use that package >> * By real-world her

Re: [go-nuts] Where can I find the format definition of stack trace?

2016-06-29 Thread Aram Hăvărneanu
> What is the meaning of +0x2d following the line number? The address of the assembly instruction relative to the start of the function. > And what is the meanings of the numbers in > Commit(0xc8201a86e0, 0x0, 0x0)? Those are the function arguments. -- Aram Hăvărneanu -- You received this me

[go-nuts] Re: A proposal for generic in go

2016-06-29 Thread Sean Russell
On Wednesday, June 29, 2016 at 2:31:59 AM UTC-4, Egon wrote: > > Just to be clear what I consider a *great example* for analyzing generics: > > 2. 3+ real-world packages/applications use that package > * By real-world here I mean it wasn't written for learning or fun, but > rather solving a conc

[go-nuts] Re: File method WriteString frequent calls led to a large system cache

2016-06-29 Thread Wei Feng
Can you say it in more detail? Thinks. 在 2016年6月28日星期二 UTC+8下午12:23:28,Tamás Gulácsi写道: > > Don't Stat on every log line, but use some other mechanism (mutex, > channel) to rotate the logs every day. -- You received this message because you are subscribed to the Google Groups "golang-nuts" gro