[go-nuts] Questions about struct conversion

2016-07-01 Thread mura
Hi all, I confronted with a confusing problem regarding struct conversion. See https://play.golang.org/p/n6NfjsthHP The declarations of PrivateKey and PublicKey are copied from crypto/rsa, but the code can not be compiled. It can be compiled successfully if the embedded field PublicKey is repla

Re: [go-nuts] Re: Singleton pattern for a client handle

2016-07-01 Thread krmayankk
does the singleton variable for any reason need to be a pointer ? On Thursday, June 30, 2016 at 4:07:08 PM UTC-7, Nathan Fisher wrote: > > I often put all of my wire-up in main which ensures that it's only one > instance. Then I create a struct that all of the dependencies hang off of > like log

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

2016-07-01 Thread Øyvind Teig
I assume the scope of the discussion about introducing generics is not how Go-generics might hypothetically be transformed to idiomatic C. I find no reference to "unsafe" in neither of these (already mentioned here): - "Proposal: Go should have generics" by Ian Lance Taylor https://github

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

2016-07-01 Thread Øyvind Teig
I assume the scope of the discussion about introducing generics is not how Go-generics might hypothetically be transformed to idiomatic Go. I find no reference to "unsafe" in neither of these (already mentioned here): - "Proposal: Go should have generics" by Ian Lance Taylor https://githu

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

2016-07-01 Thread Egon
On Friday, 1 July 2016 10:32:20 UTC+3, Øyvind Teig wrote: > > I assume the scope of the discussion about introducing generics is not how > Go-generics might hypothetically be transformed to idiomatic Go. I find no > reference to "unsafe" in neither of these (already mentioned here): > >- "Pro

[go-nuts] Re: Questions about struct conversion

2016-07-01 Thread Constantin Konstantinidis
You are redeclaring the package type. When converting type, the conversion semantics is simply mytype(a) and conversion occurs if the rule that you mention is respected. I suppose that you need to have your own struct to store date, with a different name everything works. The package type is inde

[go-nuts] Re: GUI for Go

2016-07-01 Thread Rio M
I hope for project based on Javascript+Golang server (like http://electron.atom.io/). -- 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...@go

Re: [go-nuts] Re: Singleton pattern for a client handle

2016-07-01 Thread Nathan Fisher
Methods; specifically pointer receivers. Using a value will create copies of the struct on every method call whereas pointers will use the same struct. Another benefit is to optionally do an atomic swap or use a mutex guard if you wanted to change the instance at runtime (eg config reloads). Pers

Re: [go-nuts] Append to slice... what happens?

2016-07-01 Thread Martin Geisler
Hi Ian, On Mon, Jun 27, 2016 at 8:18 PM, Ian Lance Taylor wrote: > On Sun, Jun 26, 2016 at 10:55 PM, Dan Kortschak > wrote: >> On Mon, 2016-06-27 at 07:49 +0200, Martin Geisler wrote: >>> BTW, I was about to say that you could simplify the line one step >>> further with >>> >>> b := append(a[:

[go-nuts] Re: GUI for Go

2016-07-01 Thread Mandolyte
I noticed that the QML project has been forked, so it may have some new energy -- 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...@googlegroup

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

2016-07-01 Thread Martin Geisler
On Fri, Jul 1, 2016 at 3:15 AM, Chad wrote: > No, it's actually fine. You are comparing values. > > A slice being a struct under the hood, for slices you would compare the > structs (slice headers) Yes, when you remember that a slice is a just a small struct with a pointer and some bookkeeping in

[go-nuts] Re: GUI for Go

2016-07-01 Thread paraiso . marc
AFAIK none of the projects related to GUI programming in Go are professional grade or nearly complete. There are some bindings for QML and Gtk3 but there are extremely limited. You'd be better off using C++ ,C(with GObject), Javascript, Python,Vala or Java here. All these languages have robust

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

2016-07-01 Thread charraster
On Wednesday, June 15, 2016 at 3:04:05 AM UTC+2, xingtao zhao wrote: > > Here is my proposal for generic in go: > https://docs.google.com/document/d/1nO7D15c2B3eq2kF62C0yUs_UgpkyPL2zHhMAmlq1l98/edit?usp=sharing > > Many parts has not been finished, and just initial thoughts. In the > proposal,

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

2016-07-01 Thread Chad
On Friday, July 1, 2016 at 12:11:43 PM UTC+2, Martin Geisler wrote: > > On Fri, Jul 1, 2016 at 3:15 AM, Chad > > wrote: > > No, it's actually fine. You are comparing values. > > > > A slice being a struct under the hood, for slices you would compare the > > structs (slice headers) > > Yes, wh

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

2016-07-01 Thread Chad
However, that it's a valid point you raise (re strings) But that's exactly the reason for which, someone would probably ask whether a string is a reference type or a value type. This could probably made clearer in the documentation. On Friday, July 1, 2016 at 12:48:28 PM UTC+2, Chad wrote: > > O

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

2016-07-01 Thread Andrew Mezoni
>> Now imagine that T=int8 Generic struct always has the same size only because it uses pointers. type S struct { elem T arr []T } Is the same as the following struct. type S struct { elem unsafe.Pointer arr []unsafe.Pointer } This is because it is designed to be universal. You may

[go-nuts] Use httputil.NewSingleHostReverseProxy and forward to a second proxy

2016-07-01 Thread ultrarun81
Hey Guys, i have a problem. I want to use the NewSingleHostReverseProxy Function in Go an forward a request to a second proxy. Here my code ... proxyUrl, _ := url.Parse("http://localhost:8118";) remote = parseURL("http://abcd.tld";) http.DefaultTransport = &http.Transport{Proxy: http.ProxyU

Re: [go-nuts] Append to slice... what happens?

2016-07-01 Thread Ian Lance Taylor
On Fri, Jul 1, 2016 at 2:42 AM, Martin Geisler wrote: > > On Mon, Jun 27, 2016 at 8:18 PM, Ian Lance Taylor wrote: >> On Sun, Jun 26, 2016 at 10:55 PM, Dan Kortschak >> wrote: >>> On Mon, 2016-06-27 at 07:49 +0200, Martin Geisler wrote: BTW, I was about to say that you could simplify the li

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

2016-07-01 Thread Martin Geisler
On Fri, Jul 1, 2016 at 12:48 PM, Chad wrote: > On Friday, July 1, 2016 at 12:11:43 PM UTC+2, Martin Geisler wrote: >> >> On Fri, Jul 1, 2016 at 3:15 AM, Chad wrote: >> > No, it's actually fine. You are comparing values. >> > >> > A slice being a struct under the hood, for slices you would compare

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

2016-07-01 Thread Martin Geisler
On Fri, Jul 1, 2016 at 12:52 PM, Chad wrote: > However, that it's a valid point you raise (re strings) > But that's exactly the reason for which, someone would probably ask whether > a string is a reference type or a value type. > > This could probably made clearer in the documentation. I keep se

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

2016-07-01 Thread Chad
Yes. You're absolutely right.That's due to the current implementation of strings. Maybe they should be implemented as a struct with an unexported array of byte That would just work. Having the string kind with the same structure as a slice is the problem here. strings should probably be pure v

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

2016-07-01 Thread Chad
On Friday, July 1, 2016 at 3:44:10 PM UTC+2, Martin Geisler wrote: > > On Fri, Jul 1, 2016 at 12:52 PM, Chad > > wrote: > > However, that it's a valid point you raise (re strings) > > But that's exactly the reason for which, someone would probably ask > whether > > a string is a reference ty

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

2016-07-01 Thread Chad
On Friday, July 1, 2016 at 4:01:54 PM UTC+2, Chad wrote: > > > > On Friday, July 1, 2016 at 3:44:10 PM UTC+2, Martin Geisler wrote: >> >> On Fri, Jul 1, 2016 at 12:52 PM, Chad wrote: >> > However, that it's a valid point you raise (re strings) >> > But that's exactly the reason for which, some

[go-nuts] Re: Questions about struct conversion

2016-07-01 Thread mura
Hi, Thanks for your reply. FWIW, this code works: https://play.golang.org/p/hcakVsG6qd So the naming of structs or their field probably doesn't matter. On Friday, July 1, 2016 at 3:49:11 PM UTC+8, Constantin Konstantinidis wrote: > > You are redeclaring the package type. > When converting type

[go-nuts] Re: GUI for Go

2016-07-01 Thread Peter Howard
My github project shows a simple way to make a go gui based on an html5 model by using css and the Bootstrap library and go's template package. It also shows how to compile the whole thing including the dedicated local server and the html and css into a single executable. https://github.com/pet

[go-nuts] Re: GUI for Go

2016-07-01 Thread Fino
may be we need to wait for webassembly's golang translate. but some platform native features still cannot be done in a brower. BR fino -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails fro

Re: [go-nuts] GIMP plugins written in pure Go

2016-07-01 Thread Sam Whited
On Thu, Jun 30, 2016 at 10:37 PM, simran wrote: > I'm wanting to write some image modification stuff and want to plug it into > GIMP, and being able to look at samples would really help. This doesn't answer your question, but I'd be curious to see what sort of performance characteristics you get

[go-nuts] Re: GUI for Go

2016-07-01 Thread Lucio
https://github.com/peterhoward42/godesktopgui A missing "/" in the middle. On Friday, 1 July 2016 16:31:40 UTC+2, Peter Howard wrote: > > My github project shows

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

2016-07-01 Thread charraster
On Friday, July 1, 2016 at 1:53:46 PM UTC+2, Andrew Mezoni wrote: > > >> Now imagine that T=int8 > > Generic struct always has the same size only because it uses pointers. > > type S struct { > elem ***T > arr []T > } > > I believe you've made a mistake here, elem needs to be *T , not T --

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

2016-07-01 Thread Andrew Mezoni
>> I believe you've made a mistake here, elem needs to be *T , not T This was just an abstract example. I just wanted to say that if someone want to try implement a transpiller of the "Go.next" to the "Go" then the better way to represent the data of the different types (which are specified by t

[go-nuts] [ANN] new mailing list for Google APIs with Go

2016-07-01 Thread 'Jonathan Amsterdam' via golang-nuts
If you use Go to access Google APIs (for example, by using the Google Cloud API clients at import paths starting with "google.golang.org/cloud"), we recommend you join the new group google-api-go-announce . We at Google will use that l

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

2016-07-01 Thread 'Axel Wagner' via golang-nuts
On Fri, Jul 1, 2016 at 12:40 PM, wrote: > the parametrized struct got me interested, how to best handle the > embedding the arbitrary type. > > Especially passing said struct to a generic function. > > > > type S struct { > > I1 int > > C1 char > > *T1 T* > > I2 int > > *Ts1 [2]T* > > Is1 [10

[go-nuts] redirect already running processes stdout

2016-07-01 Thread ethanlewis787
I am starting to look into intercepting a running processes output. I know how to do this manually by look at /proc/$PID/fd/1 or by using gdb etc. I do not want to use os.exec and then join the child processes output with the parent. I want to start Process A and capture the output of A in Proc

[go-nuts] Re: redirect already running processes stdout

2016-07-01 Thread C Banning
Check out: https://golang.org/pkg/os/exec/#example_Cmd_StdoutPipe On Friday, July 1, 2016 at 11:35:28 AM UTC-6, ethanl...@gmail.com wrote: > > I am starting to look into intercepting

[go-nuts] Re: Questions about struct conversion

2016-07-01 Thread Constantin Konstantinidis
Indeed, zero declaration also works using rsa. prefix. package main import ( "crypto/rsa" "fmt" // "math/big" ) func main() { pub := &rsa.PublicKey{} mypub := (*rsa.PublicKey)(pub) fmt.Printf("Hello, playground %v", mypub) } On Friday, July 1, 2016 at 4:30:54 PM UTC+2, mura wrote: > > Hi, > >

Re: [go-nuts] redirect already running processes stdout

2016-07-01 Thread Konstantin Khomoutov
On Fri, 1 Jul 2016 10:28:59 -0700 (PDT) ethanlewis...@gmail.com wrote: > I am starting to look into intercepting a running processes output. I > know how to do this manually by look at /proc/$PID/fd/1 or by using > gdb etc. I do not want to use os.exec and then join the child > processes output wi

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

2016-07-01 Thread Alex Bligh
> On 30 Jun 2016, at 14:10, Martynas Pumputis wrote: > > I see :-/ > > One very fragile workaround I've had in mind is to replace any > occurrence of syscall.Syscall by syscall.Rawsyscall within call graph > of doSomeStuff(). However, the Go scheduler is not truly cooperative, > so unexpected p

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

2016-07-01 Thread Andrew Mezoni
>> The generic dilemma is this: *do you want slow programmers, slow compilers and bloated binaries, or slow execution times?* (The Java approach.) Box everything implicitly. This slows execution. I just want to add some clarification. This does not slows a whole execution. All that works fast

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

2016-07-01 Thread Egon
On Friday, 1 July 2016 21:34:10 UTC+3, Andrew Mezoni wrote: > > >> The generic dilemma is this: *do you want slow programmers, slow > compilers and bloated binaries, or slow execution times?* > > (The Java approach.) Box everything implicitly. > This slows execution. > > I just want to add som

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

2016-07-01 Thread Andrew Mezoni
>> Go has to run in environments where runtime code-generation / modification is not allowed. Where you find that I wrote about that? The generic code (not a parametrized code) executed in the same manner as the reflection works. But with a single and very big differnce. The reflection is slow b

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

2016-07-01 Thread Egon
On Friday, 1 July 2016 21:59:19 UTC+3, Andrew Mezoni wrote: > > >> Go has to run in environments where runtime code-generation / > modification is not allowed. > > Where you find that I wrote about that? > Yeah, sorry, my mistake: *1. Information about the types will be obtained not at the com

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

2016-07-01 Thread 'Axel Wagner' via golang-nuts
On Fri, Jul 1, 2016 at 8:34 PM, Andrew Mezoni wrote: > >> The generic dilemma is this: *do you want slow programmers, slow > compilers and bloated binaries, or slow execution times?* > > (The Java approach.) Box everything implicitly. > This slows execution. > > I just want to add some clarificat

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

2016-07-01 Thread 'Axel Wagner' via golang-nuts
You are still not making a clear decision about the generics dilemma here. On Fri, Jul 1, 2016 at 8:59 PM, Andrew Mezoni wrote: > >> Go has to run in environments where runtime code-generation / > modification is not allowed. > > Where you find that I wrote about that? > The generic code (not a

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

2016-07-01 Thread 'Axel Wagner' via golang-nuts
Perhaps a better question is: Given a generic function func Get(l List, i int) E { … } var a List{ 1,2,3} var b List{"1", "2", "3"} var c List{1.0, 2.0, 3.0} fmt.Println(Get(a, 0), Get(b, 1), Get(c, 2)) // Should print "1 2 3.0" implement the code, a compiler would generate for this, in C (o

Re: [go-nuts] GIMP plugins written in pure Go

2016-07-01 Thread Ian Lance Taylor
On Fri, Jul 1, 2016 at 7:37 AM, Sam Whited wrote: > On Thu, Jun 30, 2016 at 10:37 PM, simran wrote: >> I'm wanting to write some image modification stuff and want to plug it into >> GIMP, and being able to look at samples would really help. > > This doesn't answer your question, but I'd be curiou

[go-nuts] net/smtp Client.hello() prematurely sets didHello

2016-07-01 Thread 'Matthew Altman' via golang-nuts
When calling Client.hello(), and the smtp server returns a failure code (this can be reproduced via postfix smtp-sink and a flag of -r HELO,EHLO) another attempt at a Hello is not possible. https://github.com/golang/go/blob/master/src/net/smtp/smtp.go#L75 shows that the didHello flag is set bef

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

2016-07-01 Thread charraster
> How does the compiler know sizeof(T)? > interesting question. About obtaining sizeof(T). The sizeof(T) is known from the call site calling the generic function, in particular from the type of variable that's passed to the generic function. What If generic function calls another generic fu

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

2016-07-01 Thread Ian Lance Taylor
On Fri, Jul 1, 2016 at 12:51 PM, wrote: > > Perhaps modify Golang's 2.0 calling convention, that EVERY function must get > upon compilation one extra invisible-to programmer argument that is pointer > that > when said function is generic, points to sizeof(T) storage place . > If you're calling to

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

2016-07-01 Thread Andrew Mezoni
>> How does the generic function know the size of the return value? All your judgement are not correct only because you ask not a correct questions. They return pointers to appropriate values. Or you really think that the `map` also returns a value instead of pointer? How it (map) can know the s

Re: [go-nuts] GIMP plugins written in pure Go

2016-07-01 Thread Sam Whited
On Fri, Jul 1, 2016 at 2:29 PM, Ian Lance Taylor wrote: > Current release of Go have a concurrent collector that does almost all > of its work in parallel with your application. If your application is > allocating a lot of memory quickly, the collector works harder. I > don't know how well it wo

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

2016-07-01 Thread 'Axel Wagner' via golang-nuts
On Fri, Jul 1, 2016 at 9:51 PM, wrote: > > How does the compiler know sizeof(T)? >> > > > interesting question. About obtaining sizeof(T). The sizeof(T) is known > from the call site calling the generic function, in particular from the > type of variable that's passed to the generic function. >

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-07-01 Thread mhhcbon
Hi, thanks for the tip. But still i feel like there s a kind of mental gymnastic to apply which remains unfriendly package main import ( "os" "io" "compress/gzip" ) func main () { pr, pw := io.Pipe() go func () { decoder, _ := gzip.NewReader(pr) io.Copy(os.Stdout, decoder)

[go-nuts] net/smtp Client.hello() returns a single error and drops the ehlo error entirely

2016-07-01 Thread 'Matthew Altman' via golang-nuts
https://github.com/golang/go/blob/master/src/net/smtp/smtp.go#L76-L79 This method can make two distinct SMTP calls. First an EHLO and then a HELO. If the EHLO fails it attempts HELO. However, if the connection was closed remotely after EHLO the HELO will of course also fail but the error message

Re: [go-nuts] redirect already running processes stdout

2016-07-01 Thread ethanlewis787
Thanks for the answers ! I will check reptyr out. I have looked at trying to rewrite https://github.com/jerome-pouiller/reredirect which seems to be similar to what I am looking for. I want this because I would like to write a application to catch stdout of another process for logging purposes.

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

2016-07-01 Thread Andrew Mezoni
Can I ask the question out of turn? Ok. I ask. What wrong in Java way? What wrong in C# way? Of course, they have a boxing/unboxing concepts. Does this means that boxing/unboxing is very, very, very slow operations and should not be used even in Java or in C#? But they used. They used at least in

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

2016-07-01 Thread 'Axel Wagner' via golang-nuts
On Fri, Jul 1, 2016 at 10:00 PM, Andrew Mezoni wrote: > >> How does the generic function know the size of the return value? > > All your judgement are not correct only because you ask not a correct > questions. > I am not asking the questions you want me to ask, but that doesn't make it the wron

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

2016-07-01 Thread 'Axel Wagner' via golang-nuts
On Fri, Jul 1, 2016 at 10:23 PM, Andrew Mezoni wrote: > Can I ask the question out of turn? > Ok. I ask. > What wrong in Java way? > What wrong in C# way? > Nothing inherently. It just takes a performance penalty and it needs to be justified that this performance penalty is worth it. That is the

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-07-01 Thread Tong Sun
On Fri, Jul 1, 2016 at 4:13 PM, mhhcbon wrote: > I honestly admit i have no real understanding of what i m doing ... > > I can only figure out it works on the other end :o > > But its way more readable, to me, src -> transform -> transform -> sink > Then maybe check this one out? https://godoc

[go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-07-01 Thread mhhcbon
Pretty cool. Why string only ? Le vendredi 24 juin 2016 22:54:35 UTC+2, mhhcbon a écrit : > > Hi, > > I have a small func like this > > > func WriteAsWindows1252 (src string, dst string) error { > bSrc, err := ioutil.ReadFile(src) > if err != nil { > return err > } > > bDst := make([

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-07-01 Thread Tong Sun
I don't know whether you are replying to me from your following context. But assuming so, The reason it's string only is that I'm dealing with string only at the moment, and you can see from the source that the code is not mine, and I don't think I'm qualified enough to extend the functionality to

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-07-01 Thread Tong Sun
On Fri, Jul 1, 2016 at 4:36 PM, Tong Sun wrote: > > On Fri, Jul 1, 2016 at 4:13 PM, mhhcbon wrote: > >> I honestly admit i have no real understanding of what i m doing ... >> > > >> I can only figure out it works on the other end :o >> >> But its way more readable, to me, src -> transform -> trans

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

2016-07-01 Thread Andrew Mezoni
>> That there is an indirection in the struct doesn't mean that a function doesn't need to know the size of the memory it is allocating for a bucket. Your judgement are now incorrect. Obtaining the size of the of the type is not so hard at runtime. It always known from `rtype` This is how map al

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-07-01 Thread mhhcbon
Thing is, now i read at it twice, it s not writable by essence. It takes an input as a whole and transform it using a pretty nice api. To take an example about why it s not suitable for me, two days ago i was parsing git logs, which is a text stream. Ideally, i do not want to load all that text i

Re: [go-nuts] net/smtp Client.hello() returns a single error and drops the ehlo error entirely

2016-07-01 Thread Ian Lance Taylor
On Fri, Jul 1, 2016 at 1:17 PM, 'Matthew Altman' via golang-nuts wrote: > https://github.com/golang/go/blob/master/src/net/smtp/smtp.go#L76-L79 > > This method can make two distinct SMTP calls. First an EHLO and then a HELO. > If the EHLO fails it attempts HELO. However, if the connection was clos

Re: [go-nuts] Re: x/text/runes: How can i replace LF by CRLF ?

2016-07-01 Thread Tong Sun
Actually that's how I'm using it as well. I use it to deal with huge xml files and transform only those pieces that I'm interested in. Anyway, I'm not expecting that one can fit all, but instead, just sharing the idea how transforming can be chained together in one particular way. Happy hacking.

Re: [go-nuts] redirect already running processes stdout

2016-07-01 Thread as . utf8
Most systems don't support this functionality without a kernel patch or debugger trick. You can manipulate the file descriptor before the process is born, everything afterwards is luck or system specific. In Go, you have a lot more power: os.Stdout, os. Stderr = os.Stderr, os.Stdout fmt.Prin

Re: [go-nuts] net/smtp Client.hello() returns a single error and drops the ehlo error entirely

2016-07-01 Thread 'Matthew Altman' via golang-nuts
I believe it can. MTAs are highly configurable to return any sort of errors and/or disconnects on various conditions, thus the postfix smtp-sink capabilities to test out all of those settings, and that's how we encountered this issue. *Matthew Altman* *Sr. Software Engineer* On Fri, Jul 1, 2016

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

2016-07-01 Thread 'Axel Wagner' via golang-nuts
You are still avoiding answering the one simple question that would explain perfectly well, without any room for misunderstanding, what you are proposing. I would also like to point out again that I am not arguing in favor or against the C++ or the Java way. I am simply trying to get you to answer

[go-nuts] Re: How to emulate "defer" in C++, a funny blog entry

2016-07-01 Thread dollarlux . ubicommerce
https://github.com/guangzhuwu/defer On Wednesday, January 16, 2013 at 2:16:10 AM UTC-8, Anssi Porttikivi wrote: > > How to emulate "defer" in C++, a funny blog entry > http://pointermath.wordpress.com/2012/12/26/golang-my-c-defer/ > -- You received this message because you are subscribed to the

[go-nuts] Re: net/smtp Client.hello() returns a single error and drops the ehlo error entirely

2016-07-01 Thread will.sarka via golang-nuts
The handling outside of a HELO,HELO appear to work correctly. Setting the Postfix smtp-sink to return a soft bounce on DATA, for instance, presents to issues whatsoever. Just HELO,EHLO. Here's the full command line for the Postfix sink: sudo /usr/sbin/smtp-sink -Q EHLO,HELO -u root -v 0.0.0.0:

Re: [go-nuts] Re: How to emulate "defer" in C++, a funny blog entry

2016-07-01 Thread dollarlux . ubicommerce
https://github.com/guangzhuwu/defer On Thursday, January 17, 2013 at 1:28:30 PM UTC-8, mkb wrote: > > On Thu, Jan 17, 2013 at 4:22 PM, Nick Craig-Wood > wrote: > > Agree 100% with that! Make variable shadowing a compiler error is my > > opinion, but that is probably another thread ;-) > > Yu

[go-nuts] callee returns nil, caller does not see nil

2016-07-01 Thread Kevin Manley
I am new to Go so I'm sure this is just me misunderstanding how things work, but I was surprised at this result. Please can someone help me understand why the return value from Validate() is not seen as nil by the caller, despite Validate() returning nil? TIA, Kevin https://play.golang.org/p/U

Re: [go-nuts] callee returns nil, caller does not see nil

2016-07-01 Thread Caleb Spare
https://golang.org/doc/faq#nil_error Make Validate return error, not MultiError. -Caleb On Fri, Jul 1, 2016 at 5:04 PM, Kevin Manley wrote: > I am new to Go so I'm sure this is just me misunderstanding how things work, > but I was surprised at this result. Please can someone help me understand

Re: [go-nuts] callee returns nil, caller does not see nil

2016-07-01 Thread Kevin Manley
Thanks, makes sense On Friday, July 1, 2016 at 8:06:45 PM UTC-4, Caleb Spare wrote: > > https://golang.org/doc/faq#nil_error > > Make Validate return error, not MultiError. > > -Caleb > > On Fri, Jul 1, 2016 at 5:04 PM, Kevin Manley > wrote: > > I am new to Go so I'm sure this is just me misu

[go-nuts] can't install gomobile

2016-07-01 Thread JM
windows pro on 64x. Anyone know what's going on here? Im using the following reference. https://github.com/golang/go/wiki/Mobile C:\WINDOWS\system32>go get golang.org/x/mobile/cmd/gomobile C:\WINDOWS\system32>gomobile init gomobile: rename C:\GoPath\pkg\gomobile\work-399306583\android-ndk-r12\

Re: [go-nuts] GIMP plugins written in pure Go

2016-07-01 Thread simran
Thanks Mike, really appreciate you doing up a sample so quickly. Sam, will keep you posted on how i progress (although progress will be slow... only got a couple of hours a week to spend on it :) I'm not worried about performance though... i'm not processing video, and images are likely to be one

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

2016-07-01 Thread Matt Harden
Conceptually, the value of a string is the sequence of bytes it contains, just like an array of bytes. It doesn't matter that the implementation of strings looks more like a slice internally. On the other hand the value of a slice is a reference to (part of) an underlying array, together with a len

Re: [go-nuts] Re: GUI for Go

2016-07-01 Thread Matt Harden
Don't forget that gopherjs is a thing. On Fri, Jul 1, 2016 at 7:41 AM Lucio wrote: > https://github.com/peterhoward42/godesktopgui > >

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

2016-07-01 Thread Matt Harden
Forking is not safe in Go either. On Fri, Jul 1, 2016 at 11:34 AM Alex Bligh wrote: > > > On 30 Jun 2016, at 14:10, Martynas Pumputis wrote: > > > > I see :-/ > > > > One very fragile workaround I've had in mind is to replace any > > occurrence of syscall.Syscall by syscall.Rawsyscall within ca

[go-nuts] What versions of mobile OS does go.mobile work on?

2016-07-01 Thread tnzk . marge
Hi, I am considering to write a shared library that works on both of Android and iOS using go.mobile. What versions of mobile OS does go.mobile work on? I have read the document below but it does not mention about the versions of target platform: https://github.com/golang/go/wiki/Mobile https

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

2016-07-01 Thread Andrew Mezoni
>> I would also like to point out again that I am not arguing in favor or against the C++ or the Java way. I am simply trying to get you to answer the question which of the two you are proposing. Neither one nor the other. Only the "Go way". And I am did not propose. I am only try bring underst

[go-nuts] files, readers, byte arrays (slices?), byte buffers and http.requests

2016-07-01 Thread Sri G
I'm working on receiving uploads through a form. The tricky part is validation. I attempt to read the first 1024 bytes to check the mime of the file and then if valid read the rest and hash it and also save it to disk. Reading the mime type is successful and I've gotten it to work by chaining